mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-05-05 00:20:43 -04:00
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:
@@ -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
|
||||
|
||||
|
||||
@@ -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,
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user