9
9
from ibm_cloud_sdk_core import ApiException
10
10
from ibm_cloud_sdk_core import CP4DTokenManager
11
11
from ibm_cloud_sdk_core .authenticators import IAMAuthenticator , NoAuthAuthenticator , Authenticator , BasicAuthenticator , CloudPakForDataAuthenticator
12
+ from ibm_cloud_sdk_core import get_authenticator_from_environment
12
13
13
14
14
15
class AnyServiceV1 (BaseService ):
@@ -24,7 +25,7 @@ def __init__(self,
24
25
service_url = service_url ,
25
26
authenticator = authenticator ,
26
27
disable_ssl_verification = disable_ssl_verification ,
27
- display_name = 'Watson' )
28
+ display_name = 'ibm Watson' )
28
29
self .version = version
29
30
30
31
def op_with_path_params (self , path0 , path1 ):
@@ -135,10 +136,10 @@ def test_fail_http_config():
135
136
136
137
@responses .activate
137
138
def test_iam ():
138
- iam_authenticator = IAMAuthenticator ('my_apikey' , 'https://iam-test.cloud.ibm.com/identity/token' )
139
139
file_path = os .path .join (
140
140
os .path .dirname (__file__ ), '../resources/ibm-credentials-iam.env' )
141
141
os .environ ['IBM_CREDENTIALS_FILE' ] = file_path
142
+ iam_authenticator = get_authenticator_from_environment ('ibm-watson' )
142
143
service = AnyServiceV1 ('2017-07-07' , authenticator = iam_authenticator )
143
144
assert service .service_url == 'https://gateway.watsonplatform.net/test/api'
144
145
del os .environ ['IBM_CREDENTIALS_FILE' ]
@@ -153,7 +154,7 @@ def test_iam():
153
154
}
154
155
responses .add (
155
156
responses .POST ,
156
- url = 'https://iam-test .cloud.ibm.com/identity/token' ,
157
+ url = 'https://iam.cloud.ibm.com/identity/token' ,
157
158
body = json .dumps (response ),
158
159
status = 200 )
159
160
responses .add (
0 commit comments