@@ -30,63 +30,6 @@ def test_iam_assume_authenticator():
30
30
assert authenticator .token_manager .iam_account_id is None
31
31
assert authenticator .token_manager .scope is None
32
32
33
- authenticator .set_iam_profile_id ('my-id-123' )
34
- assert authenticator .token_manager .iam_profile_id == 'my-id-123'
35
-
36
- authenticator .set_iam_profile_crn ('crn:iam-profile:456' )
37
- assert authenticator .token_manager .iam_profile_crn == 'crn:iam-profile:456'
38
-
39
- # We need to unset the other IAM related attributes to avoid validation error.
40
- authenticator .set_iam_profile_id (None )
41
- authenticator .set_iam_profile_crn (None )
42
- authenticator .set_iam_profile_name_and_account_id ('my-profile-name' , 'my-acc-id' )
43
- assert authenticator .token_manager .iam_profile_name == 'my-profile-name'
44
- assert authenticator .token_manager .iam_account_id == 'my-acc-id'
45
-
46
- with pytest .raises (TypeError ) as err :
47
- authenticator .set_headers ('dummy' )
48
- assert str (err .value ) == 'headers must be a dictionary'
49
-
50
- authenticator .set_headers ({'dummy' : 'headers' })
51
- assert authenticator .token_manager .headers == {'dummy' : 'headers' }
52
-
53
- with pytest .raises (TypeError ) as err :
54
- authenticator .set_proxies ('dummy' )
55
- assert str (err .value ) == 'proxies must be a dictionary'
56
-
57
- authenticator .set_proxies ({'dummy' : 'proxies' })
58
- assert authenticator .token_manager .proxies == {'dummy' : 'proxies' }
59
-
60
- authenticator .set_disable_ssl_verification (True )
61
- assert authenticator .token_manager .disable_ssl_verification
62
-
63
-
64
- def test_disable_ssl_verification ():
65
- authenticator = IAMAssumeAuthenticator (
66
- apikey = 'my_apikey' , iam_profile_id = 'my-profile-id' , disable_ssl_verification = True
67
- )
68
- assert authenticator .token_manager .disable_ssl_verification is True
69
- assert authenticator .token_manager .iam_delegate .disable_ssl_verification is True
70
-
71
- authenticator .set_disable_ssl_verification (False )
72
- assert authenticator .token_manager .disable_ssl_verification is False
73
- assert authenticator .token_manager .iam_delegate .disable_ssl_verification is False
74
-
75
-
76
- def test_invalid_disable_ssl_verification_type ():
77
- with pytest .raises (TypeError ) as err :
78
- authenticator = IAMAssumeAuthenticator (
79
- apikey = 'my_apikey' , iam_profile_id = 'my-profile-id' , disable_ssl_verification = 'True'
80
- )
81
- assert str (err .value ) == 'disable_ssl_verification must be a bool'
82
-
83
- authenticator = IAMAssumeAuthenticator (apikey = 'my_apikey' , iam_profile_id = 'my-profile-id' )
84
- assert authenticator .token_manager .disable_ssl_verification is False
85
-
86
- with pytest .raises (TypeError ) as err :
87
- authenticator .set_disable_ssl_verification ('True' )
88
- assert str (err .value ) == 'status must be a bool'
89
-
90
33
91
34
def test_iam_assume_authenticator_validate_failed ():
92
35
with pytest .raises (ValueError ) as err :
@@ -217,9 +160,23 @@ def test_multiple_iam_assume_authenticators():
217
160
218
161
def test_iam_assume_authenticator_unsupported_methods ():
219
162
authenticator = IAMAssumeAuthenticator ('my_apikey' , iam_profile_id = 'my_profile_id' )
163
+
220
164
with pytest .raises (AttributeError ) as err :
221
165
authenticator .set_scope ('my_scope' )
222
166
assert str (err .value ) == "'IAMAssumeAuthenticator' has no attribute 'set_scope'"
167
+
223
168
with pytest .raises (AttributeError ) as err :
224
169
authenticator .set_client_id_and_secret ('my_client_id' , 'my_client_secret' )
225
170
assert str (err .value ) == "'IAMAssumeAuthenticator' has no attribute 'set_client_id_and_secret'"
171
+
172
+ with pytest .raises (AttributeError ) as err :
173
+ authenticator .set_headers ({})
174
+ assert str (err .value ) == "'IAMAssumeAuthenticator' has no attribute 'set_headers'"
175
+
176
+ with pytest .raises (AttributeError ) as err :
177
+ authenticator .set_proxies ({})
178
+ assert str (err .value ) == "'IAMAssumeAuthenticator' has no attribute 'set_proxies'"
179
+
180
+ with pytest .raises (AttributeError ) as err :
181
+ authenticator .set_disable_ssl_verification (True )
182
+ assert str (err .value ) == "'IAMAssumeAuthenticator' has no attribute 'set_disable_ssl_verification'"
0 commit comments