Skip to content

Commit f31cdcc

Browse files
committed
Fixes unit tests for ADS auth.
1 parent c74eebd commit f31cdcc

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

ads/common/auth.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,11 @@ def set_auth(
200200
"""
201201
signer_kwargs = signer_kwargs or {}
202202
client_kwargs = {
203-
"service_endpoint": OCI_ODSC_SERVICE_ENDPOINT,
203+
**(
204+
{"service_endpoint": OCI_ODSC_SERVICE_ENDPOINT}
205+
if OCI_ODSC_SERVICE_ENDPOINT
206+
else {}
207+
),
204208
**(client_kwargs or {}),
205209
}
206210

@@ -498,7 +502,12 @@ def default_signer(client_kwargs: Optional[Dict] = None) -> Dict:
498502
>>> auth = ads.auth.default_signer() # signer_callable instantiated
499503
>>> oc.OCIClientFactory(**auth).object_storage # Creates Object storage client using instance principal authentication
500504
"""
501-
default_client_kwargs = {"service_endpoint": OCI_ODSC_SERVICE_ENDPOINT}
505+
default_client_kwargs = (
506+
{"service_endpoint": OCI_ODSC_SERVICE_ENDPOINT}
507+
if OCI_ODSC_SERVICE_ENDPOINT
508+
else {}
509+
)
510+
502511
auth_state = AuthState()
503512
if auth_state.oci_signer or auth_state.oci_signer_callable:
504513
configuration = ads.telemetry.update_oci_client_config(auth_state.oci_config)

tests/unitary/default_setup/auth/test_auth.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
55

66
import os
7-
from mock import MagicMock
87
import pytest
98
from unittest import TestCase, mock
109

0 commit comments

Comments
 (0)