From d38b7f18102c17ff647e27d6c8d6275a5112a789 Mon Sep 17 00:00:00 2001 From: rpk Date: Tue, 3 Dec 2024 12:39:17 +0100 Subject: [PATCH] Fix --- tests/test_guardian.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/test_guardian.py b/tests/test_guardian.py index 6e9493d..408bb85 100644 --- a/tests/test_guardian.py +++ b/tests/test_guardian.py @@ -57,14 +57,16 @@ def test_get_guardian_token_failed_response() -> None: assert "401" in str(exc_info.value) +def mock_fetch_personal_token(): + fake_auto_token = "auto_fetched_token" + return fake_auto_token + + @responses.activate def test_call_api_without_keycloak_token(monkeypatch: pytest.MonkeyPatch) -> None: monkeypatch.setenv("DAPLA_ENVIRONMENT", "TEST") - fake_auto_token = "auto_fetched_token" - fake_maskinporten_token = "maskinporten_access_token" - def mock_fetch_personal_token(): - return fake_auto_token + fake_maskinporten_token = "maskinporten_access_token" monkeypatch.setattr( "dapla.AuthClient.fetch_personal_token", mock_fetch_personal_token