0
我想在我的瓶子應用程序中構建一系列藍圖的測試環境。目錄結構看起來有點像這樣:找到所有前綴有特定瓶的前綴
run.py
app/
blueprints/
__init__.py
bp.py
bp2.py
bp3.py
__init__.py
views.py
初始化藍圖目錄內的.py看起來是這樣的:
from app import app
from bp import bp
from bp2 import bp2
app.register_blueprint(bp, url_prefix('/generate'))
app.register_blueprint(bp2, url_prefix('/generate'))
app.register_blueprint(bp3, url_prefix('/do_something_else'))
現在,我想推出一個測試系統,做這樣的事情(僞代碼):
for every url that starts with /generate:
j = json.load(that_url())
with open('fixture.json', 'r') as fixture:
if j == json.load(fixture):
app.logger.info('TEST PASSED')
這將如何工作?