Create fixture that just calls create_app

This commit is contained in:
Ryan Ahearn
2022-12-13 08:53:41 -05:00
parent 0d0db5f6f6
commit 6aa46da916
2 changed files with 10 additions and 6 deletions

View File

@@ -12,16 +12,20 @@ from app.dao.provider_details_dao import get_provider_details_by_identifier
@pytest.fixture(scope='session')
def notify_api():
def notify_app():
app = Flask('test')
create_app(app)
return app
@pytest.fixture(scope='session')
def notify_api(notify_app):
# deattach server-error error handlers - error_handler_spec looks like:
# {'blueprint_name': {
# status_code: [error_handlers],
# None: { ExceptionClass: error_handler }
# }}
for error_handlers in app.error_handler_spec.values():
for error_handlers in notify_app.error_handler_spec.values():
error_handlers.pop(500, None)
if None in error_handlers:
error_handlers[None] = {
@@ -32,10 +36,10 @@ def notify_api():
if error_handlers[None] == []:
error_handlers.pop(None)
ctx = app.app_context()
ctx = notify_app.app_context()
ctx.push()
yield app
yield notify_app
ctx.pop()