带认证的试验瓶应用
Flask-Attest的Python项目详细描述
自动测试用瓶的延伸部分。
功能:
- 类似烧瓶的API
- 在测试中处理请求上下文
- 捕获有关渲染模板的元数据
- 用assert语句自然地编写测试条件
from flaskext.attest import request_context, get from myapp import app from attest import Tests from flask import Response TESTING = True @request_context def testapp(): app.config.from_object(__name__) return app frontend = Tests(context=[testapp]) @frontend.test @get('/') def index(response): assert response == Response('Welcome!')