相关疑难解决方法(0)

测试Flask render_template()上下文

新手烧瓶问题.

我有一个看起来像这样的Flask路线:

@app.route('/')                                                                 
def home():                                                                                                                  
    return render_template(                                                     
        'home.html',                                                            
        greeting:"hello"                                       
    )                                                                           
Run Code Online (Sandbox Code Playgroud)

如何测试'home.html'模板是否已呈现,以及render_template()上下文是否greeting使用特定值定义了变量?

这些应该(并且可能是)很容易测试,但我真的不确定如何使用Flask和unittest来做到这一点.

python flask

25
推荐指数
3
解决办法
8268
查看次数

标签 统计

flask ×1

python ×1