@@ -196,7 +196,7 @@ def test_request_token_success():
196
196
def test_authenticate_success ():
197
197
authenticator = ContainerAuthenticator (
198
198
cr_token_filename = cr_token_file ,
199
- iam_profile_name = 'iam-user-123' )
199
+ iam_profile_name = MOCK_IAM_PROFILE_NAME )
200
200
201
201
request = {'headers' : {}}
202
202
@@ -222,7 +222,7 @@ def test_authenticate_success():
222
222
def test_authenticate_fail_no_cr_token ():
223
223
authenticator = ContainerAuthenticator (
224
224
cr_token_filename = 'bogus-cr-token-file' ,
225
- iam_profile_name = 'iam-user-123' ,
225
+ iam_profile_name = MOCK_IAM_PROFILE_NAME ,
226
226
url = 'https://bogus.iam.endpoint' )
227
227
228
228
request = {'headers' : {}}
@@ -237,7 +237,7 @@ def test_authenticate_fail_no_cr_token():
237
237
def test_authenticate_fail_iam ():
238
238
authenticator = ContainerAuthenticator (
239
239
cr_token_filename = cr_token_file ,
240
- iam_profile_name = 'iam-user-123' ,
240
+ iam_profile_name = MOCK_IAM_PROFILE_NAME ,
241
241
scope = 'status-bad-request' )
242
242
243
243
request = {'headers' : {}}
@@ -259,3 +259,17 @@ def test_client_id_and_secret():
259
259
token_manager .set_scope ('check-basic-auth' )
260
260
access_token = token_manager .get_token ()
261
261
assert access_token == TEST_ACCESS_TOKEN_1
262
+
263
+ @mock_iam_response
264
+ def test_setter_methods ():
265
+ token_manager = ContainerTokenManager (
266
+ cr_token_filename = 'bogus-cr-token-file' ,
267
+ iam_profile_id = MOCK_IAM_PROFILE_NAME ,
268
+ )
269
+
270
+ token_manager .set_iam_profile_id ('iam-id-123' )
271
+ token_manager .set_iam_profile_name (None )
272
+ token_manager .set_cr_token_filename (cr_token_file )
273
+
274
+ access_token = token_manager .get_token ()
275
+ assert access_token == TEST_ACCESS_TOKEN_1
0 commit comments