@@ -16,7 +16,6 @@ class TestAuthnApi(api_config.ConfiguredTest):
1616 def setUpClass (cls ):
1717 super ().setUpClass ()
1818 cls .api_key = os .environ [CONJUR_AUTHN_API_KEY ]
19- cls .account = os .environ [CONJUR_ACCOUNT ]
2019
2120 @classmethod
2221 def tearDownClass (cls ):
@@ -32,6 +31,10 @@ def setUp(self):
3231 self .client = openapi_client .ApiClient (self .config )
3332 self .api = openapi_client .api .authn_api .AuthnApi (self .client )
3433
34+ self .bad_auth_api = openapi_client .api .authn_api .AuthnApi (
35+ self .bad_auth_client
36+ )
37+
3538 def tearDown (self ):
3639 self .client .close ()
3740
@@ -66,6 +69,28 @@ def test_login(self):
6669 with self .assertRaises (openapi_client .exceptions .ApiException ):
6770 self .api .login ('authn' , self .account )
6871
72+ # We dont have this authenticator setup so we cant authenticate with it
73+ @unittest .expectedFailure
74+ def test_service_login_200 (self ):
75+ """Test case for service_login 200 response
76+
77+ Login with the given authenticator
78+ """
79+ _ , status , _ = self .api .service_login_with_http_info (
80+ 'iam' ,
81+ 'aws' ,
82+ self .account
83+ )
84+
85+ self .assertEqual (status , 200 )
86+
87+ def test_service_login_401 (self ):
88+ """Test case for service_login 401 response"""
89+ with self .assertRaises (openapi_client .exceptions .ApiException ) as context :
90+ self .bad_auth_api .service_login ('iam' , 'aws' , self .account )
91+
92+ self .assertEqual (context .exception .status , 401 )
93+
6994 def test_rotate_api_key (self ):
7095 """Test case for rotate_api_key
7196
@@ -108,5 +133,33 @@ def test_set_password(self):
108133 with self .assertRaises (openapi_client .exceptions .ApiException ):
109134 self .api .set_password (self .account , body = invalid_pass )
110135
136+ # We dont have this setup so we cant change the config
137+ @unittest .expectedFailure
138+ def test_update_authenticator_config_204 (self ):
139+ """Test case for update_authenticator_config 204 response
140+
141+ Updates the authenticators configuration
142+ """
143+ _ , status , _ = self .api .update_authenticator_config_with_http_info (
144+ 'oidc' ,
145+ 'okta' ,
146+ self .account ,
147+ body = 'enabled=false'
148+ )
149+
150+ self .assertEqual (status , 204 )
151+
152+ def test_update_authenticator_config_401 (self ):
153+ """Test case for update_authenticator_config 401 response"""
154+ with self .assertRaises (openapi_client .exceptions .ApiException ) as context :
155+ self .bad_auth_api .update_authenticator_config (
156+ 'oidc' ,
157+ 'okta' ,
158+ self .account ,
159+ body = 'enabled=false'
160+ )
161+
162+ self .assertEqual (context .exception .status , 401 )
163+
111164if __name__ == '__main__' :
112165 unittest .main ()
0 commit comments