diff --git a/src/bk-login/tests/open_apis/conftest.py b/src/bk-login/tests/open_apis/conftest.py index aa086a6f3..9ff3e7b14 100644 --- a/src/bk-login/tests/open_apis/conftest.py +++ b/src/bk-login/tests/open_apis/conftest.py @@ -14,15 +14,21 @@ # # We undertake not to change the open source license (MIT license) applicable # to the current version of the project delivered to anyone in the future. -from unittest import mock +import os import pytest from django.test import Client +from django.test.utils import override_settings @pytest.fixture def open_api_client() -> Client: client = Client() - with mock.patch("bklogin.open_apis.mixins.APIGatewayAppVerifiedMixin.skip_app_verified", return_value=True): + # Set new environment variables + os.environ["APIGW_MANAGER_DUMMY_GATEWAY_NAME"] = "bk-login" + os.environ["APIGW_MANAGER_DUMMY_PAYLOAD_APP_CODE"] = "app_code" + os.environ["APIGW_MANAGER_DUMMY_PAYLOAD_USERNAME"] = "username" + + with override_settings(BK_APIGW_JWT_PROVIDER_CLS="apigw_manager.apigw.providers.DummyEnvPayloadJWTProvider"): yield client