7
7
def test_container_authenticator ():
8
8
authenticator = ContainerAuthenticator (iam_profile_name = 'iam-user-123' )
9
9
assert authenticator is not None
10
+ assert authenticator .token_manager .cr_token_filename is None
11
+ assert authenticator .token_manager .iam_profile_name == 'iam-user-123'
12
+ assert authenticator .token_manager .iam_profile_id is None
10
13
assert authenticator .token_manager .client_id is None
11
14
assert authenticator .token_manager .client_secret is None
12
15
assert authenticator .token_manager .disable_ssl_verification is False
@@ -21,7 +24,8 @@ def test_container_authenticator():
21
24
# because both of the profile and ID are None.
22
25
with pytest .raises (ValueError ) as err :
23
26
authenticator .set_iam_profile_name (None )
24
- assert str (err .value ) == 'At least one of iam_profile_name or iam_profile_id must be specified.'
27
+ assert str (
28
+ err .value ) == 'At least one of iam_profile_name or iam_profile_id must be specified.'
25
29
26
30
authenticator .set_iam_profile_id ('iam-id-123' )
27
31
assert authenticator .token_manager .iam_profile_id == 'iam-id-123'
@@ -52,7 +56,8 @@ def test_container_authenticator():
52
56
53
57
54
58
def test_disable_ssl_verification ():
55
- authenticator = ContainerAuthenticator (iam_profile_name = 'iam-user-123' , disable_ssl_verification = True )
59
+ authenticator = ContainerAuthenticator (
60
+ iam_profile_name = 'iam-user-123' , disable_ssl_verification = True )
56
61
assert authenticator .token_manager .disable_ssl_verification is True
57
62
58
63
authenticator .set_disable_ssl_verification (False )
@@ -61,7 +66,8 @@ def test_disable_ssl_verification():
61
66
62
67
def test_invalid_disable_ssl_verification_type ():
63
68
with pytest .raises (TypeError ) as err :
64
- authenticator = ContainerAuthenticator (iam_profile_name = 'iam-user-123' , disable_ssl_verification = 'True' )
69
+ authenticator = ContainerAuthenticator (
70
+ iam_profile_name = 'iam-user-123' , disable_ssl_verification = 'True' )
65
71
assert str (err .value ) == 'disable_ssl_verification must be a bool'
66
72
67
73
authenticator = ContainerAuthenticator (iam_profile_name = 'iam-user-123' )
@@ -73,22 +79,26 @@ def test_invalid_disable_ssl_verification_type():
73
79
74
80
75
81
def test_container_authenticator_with_scope ():
76
- authenticator = ContainerAuthenticator (iam_profile_name = 'iam-user-123' , scope = 'scope1 scope2' )
82
+ authenticator = ContainerAuthenticator (
83
+ iam_profile_name = 'iam-user-123' , scope = 'scope1 scope2' )
77
84
assert authenticator is not None
78
85
assert authenticator .token_manager .scope == 'scope1 scope2'
79
86
80
87
81
88
def test_authenticator_validate_failed ():
82
89
with pytest .raises (ValueError ) as err :
83
90
ContainerAuthenticator (None )
84
- assert str (err .value ) == 'At least one of iam_profile_name or iam_profile_id must be specified.'
91
+ assert str (
92
+ err .value ) == 'At least one of iam_profile_name or iam_profile_id must be specified.'
85
93
86
94
with pytest .raises (ValueError ) as err :
87
- ContainerAuthenticator (iam_profile_name = 'iam-user-123' , client_id = 'my_client_id' )
95
+ ContainerAuthenticator (
96
+ iam_profile_name = 'iam-user-123' , client_id = 'my_client_id' )
88
97
assert str (
89
98
err .value ) == 'Both client_id and client_secret should be initialized.'
90
99
91
100
with pytest .raises (ValueError ) as err :
92
- ContainerAuthenticator (iam_profile_name = 'iam-user-123' , client_secret = 'my_client_secret' )
101
+ ContainerAuthenticator (
102
+ iam_profile_name = 'iam-user-123' , client_secret = 'my_client_secret' )
93
103
assert str (
94
104
err .value ) == 'Both client_id and client_secret should be initialized.'
0 commit comments