Skip to content

Commit

Permalink
fix: unittest
Browse files Browse the repository at this point in the history
  • Loading branch information
nannan00 committed Dec 28, 2024
1 parent 44a5028 commit a504bce
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/bk-login/tests/open_apis/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit a504bce

Please sign in to comment.