diff --git a/tests/clients/test_guard_client.py b/tests/clients/test_guard_client.py index 7c28e2b..f74c8fa 100644 --- a/tests/clients/test_guard_client.py +++ b/tests/clients/test_guard_client.py @@ -3,7 +3,6 @@ from src.classes.http_error import HttpError # from src.clients.memory_guard_client import MemoryGuardClient -from src.clients.pg_guard_client import PGGuardClient from src.models.guard_item import GuardItem from src.models.guard_item_audit import GuardItemAudit from tests.mocks.mock_postgres_client import MockPostgresClient @@ -15,6 +14,8 @@ def test_init(mocker): mock_pg_client = MockPostgresClient() mocker.patch("src.clients.pg_guard_client.PostgresClient", return_value=mock_pg_client) + from src.clients.pg_guard_client import PGGuardClient + pg_guard_client = PGGuardClient() # mem_guard_client = MemoryGuardClient() @@ -40,6 +41,9 @@ def test_get_latest(self, mocker): "src.clients.pg_guard_client.GuardStruct.from_guard_item" ) mock_from_guard_item.return_value = latest_guard + + from src.clients.pg_guard_client import PGGuardClient + guard_client = PGGuardClient() @@ -71,6 +75,8 @@ def test_with_as_of_date(self, mocker): "src.clients.pg_guard_client.GuardStruct.from_guard_item" ) mock_from_guard_item.return_value = previous_guard + + from src.clients.pg_guard_client import PGGuardClient guard_client = PGGuardClient() @@ -108,6 +114,8 @@ def test_raises_not_found(self, mocker): mock_from_guard_item = mocker.patch( "src.clients.pg_guard_client.GuardStruct.from_guard_item" ) + + from src.clients.pg_guard_client import PGGuardClient guard_client = PGGuardClient() @@ -132,6 +140,8 @@ def test_get_guard_item(mocker): mock_first = mocker.patch.object(mock_pg_client.db.session, "first") latest_guard = MockGuardStruct("latest") mock_first.return_value = latest_guard + + from src.clients.pg_guard_client import PGGuardClient guard_client = PGGuardClient() @@ -160,6 +170,8 @@ def test_get_guards(mocker): ) mock_from_guard_item.side_effect = [guard_one, guard_two] + from src.clients.pg_guard_client import PGGuardClient + guard_client = PGGuardClient() result = guard_client.get_guards() @@ -189,6 +201,8 @@ def test_create_guard(mocker): ) mock_from_guard_item.return_value = mock_guard + from src.clients.pg_guard_client import PGGuardClient + guard_client = PGGuardClient() result = guard_client.create_guard(mock_guard) @@ -229,6 +243,8 @@ def test_raises_not_found(self, mocker): mock_from_guard_item = mocker.patch( "src.clients.pg_guard_client.GuardStruct.from_guard_item" ) + + from src.clients.pg_guard_client import PGGuardClient guard_client = PGGuardClient() @@ -264,6 +280,8 @@ def test_updates_guard_item(self, mocker): ) mock_from_guard_item.return_value = updated_guard + from src.clients.pg_guard_client import PGGuardClient + guard_client = PGGuardClient() result = guard_client.update_guard("mock-guard", updated_guard) @@ -301,6 +319,8 @@ def test_guard_doesnt_exist_yet(self, mocker): "src.clients.pg_guard_client.PGGuardClient.create_guard" ) mock_create_guard.return_value = new_guard + + from src.clients.pg_guard_client import PGGuardClient guard_client = PGGuardClient() @@ -331,6 +351,8 @@ def test_guard_already_exists(self, mocker): "src.clients.pg_guard_client.GuardStruct.from_guard_item" ) mock_from_guard_item.return_value = updated_guard + + from src.clients.pg_guard_client import PGGuardClient guard_client = PGGuardClient() @@ -363,6 +385,8 @@ def test_raises_not_found(self, mocker): mock_from_guard_item = mocker.patch( "src.clients.pg_guard_client.GuardStruct.from_guard_item" ) + + from src.clients.pg_guard_client import PGGuardClient guard_client = PGGuardClient() @@ -396,6 +420,8 @@ def test_deletes_guard_item(self, mocker): "src.clients.pg_guard_client.GuardStruct.from_guard_item" ) mock_from_guard_item.return_value = old_guard + + from src.clients.pg_guard_client import PGGuardClient guard_client = PGGuardClient()