@@ -274,13 +274,19 @@ def test_convert_list():
274
274
assert mock4_str == mock4
275
275
276
276
277
+ # pylint: disable=too-many-statements
277
278
def test_get_authenticator_from_credential_file ():
278
279
file_path = os .path .join (os .path .dirname (__file__ ),
279
280
'../resources/ibm-credentials-iam.env' )
280
281
os .environ ['IBM_CREDENTIALS_FILE' ] = file_path
281
282
authenticator = get_authenticator_from_environment ('ibm watson' )
282
283
assert authenticator is not None
283
284
assert authenticator .token_manager .apikey == '5678efgh'
285
+ assert authenticator .token_manager .url == 'https://iam.cloud.ibm.com'
286
+ assert authenticator .token_manager .client_id is None
287
+ assert authenticator .token_manager .client_secret is None
288
+ assert authenticator .token_manager .disable_ssl_verification is False
289
+ assert authenticator .token_manager .scope is None
284
290
del os .environ ['IBM_CREDENTIALS_FILE' ]
285
291
286
292
file_path = os .path .join (os .path .dirname (__file__ ),
@@ -297,7 +303,24 @@ def test_get_authenticator_from_credential_file():
297
303
authenticator = get_authenticator_from_environment ('service 1' )
298
304
assert authenticator is not None
299
305
assert authenticator .token_manager .cr_token_filename == 'crtoken.txt'
300
- assert authenticator .token_manager .iam_profile_name == 'iam-user1'
306
+ assert authenticator .token_manager .iam_profile_name == 'iam-user-123'
307
+ assert authenticator .token_manager .iam_profile_id == 'iam-id-123'
308
+ assert authenticator .token_manager .url == 'https://iamhost/iam/api'
309
+ assert authenticator .token_manager .scope == 'scope1'
310
+ assert authenticator .token_manager .client_id == 'iam-client-123'
311
+ assert authenticator .token_manager .client_secret == 'iam-secret-123'
312
+ assert authenticator .token_manager .disable_ssl_verification is True
313
+
314
+ authenticator = get_authenticator_from_environment ('service 2' )
315
+ assert authenticator is not None
316
+ assert authenticator .token_manager .cr_token_filename is None
317
+ assert authenticator .token_manager .iam_profile_name == 'iam-user-123'
318
+ assert authenticator .token_manager .iam_profile_id is None
319
+ assert authenticator .token_manager .url == 'https://iam.cloud.ibm.com'
320
+ assert authenticator .token_manager .scope is None
321
+ assert authenticator .token_manager .client_id is None
322
+ assert authenticator .token_manager .client_secret is None
323
+ assert authenticator .token_manager .disable_ssl_verification is False
301
324
del os .environ ['IBM_CREDENTIALS_FILE' ]
302
325
303
326
file_path = os .path .join (os .path .dirname (__file__ ),
@@ -307,6 +330,9 @@ def test_get_authenticator_from_credential_file():
307
330
assert authenticator is not None
308
331
assert authenticator .token_manager .username == 'my_username'
309
332
assert authenticator .token_manager .password == 'my_password'
333
+ assert authenticator .token_manager .url == 'https://my_url/v1/authorize'
334
+ assert authenticator .token_manager .apikey is None
335
+ assert authenticator .token_manager .disable_ssl_verification is False
310
336
del os .environ ['IBM_CREDENTIALS_FILE' ]
311
337
312
338
file_path = os .path .join (os .path .dirname (__file__ ),
0 commit comments