Skip to content

Commit 7ce8f19

Browse files
committed
Fix test environment variables
1 parent 1c9a8a5 commit 7ce8f19

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

tests/settings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
SUBSCRIPTION_ID = fake_settings.SUBSCRIPTION_ID
2020
RESOURCE_GROUP_NAME = fake_settings.RESOURCE_GROUP_NAME
2121
RECORD_MODE = os.environ.get('RECORD_MODE', 'all').lower()
22+
CLIENT_ID = os.environ['azure_service_principal']
2223
'''
2324
RECORD_MODE = os.environ.get('RECORD_MODE', 'none').lower()
2425

tests/test_mock.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
from azure.datalake.store.lib import auth
2525
from azure.datalake.store.lib import DataLakeCredential
2626
from tests.testing import azure, azure_teardown, posix, working_dir
27+
from tests.settings import TENANT_ID, CLIENT_ID
2728
test_dir = working_dir()
2829

2930
a = posix(test_dir / 'a')
@@ -102,7 +103,7 @@ def __test_retry_auth(error_code, error_string, is_exception_expected, total_tri
102103
end_point = re.compile("https:\/\/login\.microsoftonline\.com\/common\/discovery\/instance\?authorization_endpoint=.+")
103104
mock_url = "https://login.microsoftonline.com/" + settings.TENANT_ID+ "/oauth2/token"
104105

105-
body_discovery = r'{"tenant_discovery_endpoint":"https://login.microsoftonline.com/'+ settings.TENANT_ID + '/.well-known/openid-configuration"}'
106+
body_discovery = r'{"tenant_discovery_endpoint":"https://login.microsoftonline.com/'+ TENANT_ID + '/.well-known/openid-configuration"}'
106107
while total_tries > 0:
107108
responses.add(responses.GET, end_point,
108109
body=body_discovery,
@@ -117,7 +118,8 @@ def __test_retry_auth(error_code, error_string, is_exception_expected, total_tri
117118
status=200)
118119
responses.add(responses.POST, mock_url, body=last_try_body, status=last_try_status)
119120
try:
120-
token = auth()
121+
token = auth(tenant_id=TENANT_ID, client_secret='GARBAGE',
122+
client_id=CLIENT_ID)
121123
assert isinstance(token, DataLakeCredential)
122124
assert not is_exception_expected
123125
except (HTTPError, adal.adal_error.AdalError):

0 commit comments

Comments
 (0)