Skip to content

Commit 410969f

Browse files
committed
test: fix and improve container token manager tests
1 parent 4c59689 commit 410969f

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

test/test_container_token_manager.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def callback(request):
3737

3838
assert payload['cr_token'][0] == 'cr-token-1'
3939
assert payload['grant_type'][0] == 'urn:ibm:params:oauth:grant-type:cr-token'
40-
assert payload['profile_name'][0] or payload['iam_profile_id']
40+
assert payload.get('profile_name', [None])[0] or payload.get('profile_id', [None])[0]
4141

4242
status_code = 200
4343

@@ -264,12 +264,20 @@ def test_client_id_and_secret():
264264
def test_setter_methods():
265265
token_manager = ContainerTokenManager(
266266
cr_token_filename='bogus-cr-token-file',
267-
iam_profile_id=MOCK_IAM_PROFILE_NAME,
267+
iam_profile_name=MOCK_IAM_PROFILE_NAME,
268268
)
269269

270+
assert token_manager.iam_profile_id is None
271+
assert token_manager.iam_profile_name == MOCK_IAM_PROFILE_NAME
272+
assert token_manager.cr_token_filename == 'bogus-cr-token-file'
273+
270274
token_manager.set_iam_profile_id('iam-id-123')
271275
token_manager.set_iam_profile_name(None)
272276
token_manager.set_cr_token_filename(cr_token_file)
273277

278+
assert token_manager.iam_profile_id == 'iam-id-123'
279+
assert token_manager.iam_profile_name is None
280+
assert token_manager.cr_token_filename == cr_token_file
281+
274282
access_token = token_manager.get_token()
275283
assert access_token == TEST_ACCESS_TOKEN_1

0 commit comments

Comments
 (0)