Beispiel #1
0
 def test_should_add_HealthCheckResource(self, api_mock):
     api_instance_mock = self.mock.MagicMock()
     api_mock.return_value = api_instance_mock
     api.create_api(self.app_mock)
     self.assertTrue(
         any(mock_call == base.call(api.resources.HealthCheckResource,
                                    '/api/healthcheck')
             for mock_call in api_instance_mock.add_resource.mock_calls))
Beispiel #2
0
 def test_should_add_AvatarResource(self, api_mock):
     api_instance_mock = self.mock.MagicMock()
     api_mock.return_value = api_instance_mock
     api.create_api(self.app_mock)
     self.assertTrue(
         any(mock_call == base.call(api.resources.AvatarResource,
                                    '/api/users/me/avatar')
             for mock_call in api_instance_mock.add_resource.mock_calls))
Beispiel #3
0
def create_app():
    app = Flask(__name__)

    config_app(app)
    db.init_app(app)

    api = Api(app)
    create_api(api)

    return app
Beispiel #4
0
 def test_should_add_SharedNoteResource(self, api_mock):
     api_instance_mock = self.mock.MagicMock()
     api_mock.return_value = api_instance_mock
     api.create_api(self.app_mock)
     self.assertTrue(any(mock_call == base.call(api.resources.SharedNoteResource, '/api/users/me/shared_notes', '/api/users/me/shared_notes/<int:note_id>')
                         for mock_call in api_instance_mock.add_resource.mock_calls))
Beispiel #5
0
 def test_should_instantiate_api(self, api_mock):
     api.create_api(self.app_mock)
     self.assertTrue(api_mock.called)
Beispiel #6
0
def create_api():
    from src import api
    api.create_api(web_app)