Split models to prevent circular imports

This commit is the first step to disentangling the models from the API
clients. With the models in the same folder as the API clients it makes
it hard to import the API clients within the model without getting a
circular import.

After this commit the user API clients still has this problem, but at
least the service API client doesn’t.
This commit is contained in:
Chris Hill-Scott
2018-10-26 15:58:44 +01:00
parent 9e798506c5
commit e04b2b5631
21 changed files with 188 additions and 190 deletions

View File

@@ -4,8 +4,8 @@ from unittest.mock import patch
import pytest
import werkzeug
from app.models.service import Service
from app.notify_client import NotifyAdminAPIClient
from app.notify_client.models import Service
from tests import service_json
from tests.conftest import api_user_active, platform_admin_user, set_config

View File

@@ -3,7 +3,7 @@ from unittest.mock import call
import pytest
from app import invite_api_client, service_api_client, user_api_client
from app.notify_client.models import User
from app.models.user import User
from tests import sample_uuid
from tests.conftest import SERVICE_ONE_ID, api_user_pending
@@ -51,7 +51,7 @@ def test_client_returns_count_of_users_with_manage_service(
)
mocker.patch(
'app.notify_client.models._get_service_id_from_view_args',
'app.models.user._get_service_id_from_view_args',
return_value=SERVICE_ONE_ID,
)
@@ -221,7 +221,7 @@ def test_returns_value_from_cache(
'app.notify_client.RedisClient.set',
)
mock_model = mocker.patch(
'app.notify_client.models.User.__init__',
'app.models.user.User.__init__',
return_value=None,
)