def app() -> Generator[Flask, None, None]: """Creates a flask test app, with an app context. The app can be used to create a test http client as well: with app.test_client() as client: client.get(...) """ app = get_flask_app() with app.app_context(): yield app
def get_app(): # Start messagedriven_service in separate thread t = Thread(target=run_message_thread) t.start() return get_flask_app()
def test_get_app(self, mock_flask, mock_middleware): mock_app = mock.MagicMock() mock_flask.return_value = mock_app app = get_flask_app() mock_middleware.assert_called_with(app)
def test_get_app(self, mock_flask): mock_app = mock.MagicMock() mock_flask.return_value = mock_app app = get_flask_app() mock_flask.assert_called() mock_app.route.assert_called()