예제 #1
0
from foundations_core_rest_api_components.app_manager import AppManager

app_manager = AppManager()
    def test_app_handles_auth_error(self):
        from foundations_core_rest_api_components.exceptions import AuthError

        app = AppManager().app()
        exceptions = app.error_handler_spec[None][None]
        self.assertIn(AuthError, exceptions)
    def test_app_initialize(self):
        from flask import Flask

        app_manager = AppManager()
        self.assertTrue(isinstance(app_manager.app(), Flask))
 def test_that_api_uses_proper_app(self):
     app_manager = AppManager()
     api = app_manager.api()
     self.assertEqual(api.app, app_manager.app())
 def test_always_returns_same_api(self):
     app_manager = AppManager()
     initial_api = app_manager.api()
     second_api = app_manager.api()
     self.assertEqual(initial_api, second_api)
    def test_api_initialize(self):
        from flask_restful import Api

        app_manager = AppManager()
        self.assertTrue(isinstance(app_manager.api(), Api))
 def test_uses_calls_cors_only_once(self, mock):
     app_manager = AppManager()
     app_manager.app()
     app_manager.app()
     mock.assert_called_once()
 def test_uses_cors(self, mock):
     app_manager = AppManager()
     app = app_manager.app()
     mock.assert_called_with(app, supports_credentials=True)