From 79377b57fb80475c9ccf4e58ab603f2898cdc8c2 Mon Sep 17 00:00:00 2001 From: lchen-2101 <73617864+lchen-2101@users.noreply.github.com> Date: Tue, 19 Mar 2024 12:22:14 -0400 Subject: [PATCH] fix: test mocks --- tests/api/conftest.py | 2 +- tests/api/routers/test_admin_api.py | 6 +++--- tests/app/conftest.py | 2 +- tests/entities/repos/test_institutions_repo.py | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/api/conftest.py b/tests/api/conftest.py index ca27e49..906093d 100644 --- a/tests/api/conftest.py +++ b/tests/api/conftest.py @@ -4,7 +4,7 @@ from fastapi import FastAPI from pytest_mock import MockerFixture from starlette.authentication import AuthCredentials, UnauthenticatedUser -from regtech_api_commons.models import AuthenticatedUser +from regtech_api_commons.models.auth import AuthenticatedUser from regtech_user_fi_management.entities.models.dao import ( FinancialInstitutionDao, FinancialInstitutionDomainDao, diff --git a/tests/api/routers/test_admin_api.py b/tests/api/routers/test_admin_api.py index 7a549af..8cdbe54 100644 --- a/tests/api/routers/test_admin_api.py +++ b/tests/api/routers/test_admin_api.py @@ -5,7 +5,7 @@ from pytest_mock import MockerFixture from starlette.authentication import AuthCredentials -from regtech_api_commons.models import RegTechUser, AuthenticatedUser +from regtech_api_commons.models.auth import RegTechUser, AuthenticatedUser class TestAdminApi: @@ -15,7 +15,7 @@ def test_get_me_unauthed(self, app_fixture: FastAPI, unauthed_user_mock: Mock): assert res.status_code == 403 def test_get_me_authed(self, mocker: MockerFixture, app_fixture: FastAPI, authed_user_mock: Mock): - get_user_mock = mocker.patch("regtech_api_commons.oauth2.OAuth2Admin.get_user") + get_user_mock = mocker.patch("regtech_api_commons.oauth2.oauth2_admin.OAuth2Admin.get_user") get_user_mock.return_value = authed_user_mock.return_value[1] client = TestClient(app_fixture) res = client.get("/v1/admin/me") @@ -36,7 +36,7 @@ def test_get_me_authed_with_institutions(self, mocker: MockerFixture, app_fixtur AuthCredentials(["authenticated"]), AuthenticatedUser.from_claim(claims), ) - get_user_mock = mocker.patch("regtech_api_commons.oauth2.OAuth2Admin.get_user") + get_user_mock = mocker.patch("regtech_api_commons.oauth2.oauth2_admin.OAuth2Admin.get_user") get_user_mock.return_value = RegTechUser.from_claim(claims) client = TestClient(app_fixture) res = client.get("/v1/admin/me") diff --git a/tests/app/conftest.py b/tests/app/conftest.py index 141329c..3512078 100644 --- a/tests/app/conftest.py +++ b/tests/app/conftest.py @@ -4,7 +4,7 @@ from pytest_mock import MockerFixture from starlette.authentication import AuthCredentials -from regtech_api_commons.models import AuthenticatedUser, RegTechUser +from regtech_api_commons.models.auth import AuthenticatedUser, RegTechUser @pytest.fixture(autouse=True) diff --git a/tests/entities/repos/test_institutions_repo.py b/tests/entities/repos/test_institutions_repo.py index cf59e3e..c54921b 100644 --- a/tests/entities/repos/test_institutions_repo.py +++ b/tests/entities/repos/test_institutions_repo.py @@ -18,7 +18,7 @@ SblTypeMappingDao, ) import regtech_user_fi_management.entities.repos.institutions_repo as repo -from regtech_api_commons.models import AuthenticatedUser +from regtech_api_commons.models.auth import AuthenticatedUser class TestInstitutionsRepo: