Skip to content

Commit

Permalink
fix: test mocks
Browse files Browse the repository at this point in the history
  • Loading branch information
lchen-2101 committed Mar 19, 2024
1 parent 7ff22b7 commit 79377b5
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion tests/api/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions tests/api/routers/test_admin_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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")
Expand All @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion tests/app/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion tests/entities/repos/test_institutions_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 79377b5

Please sign in to comment.