@@ -248,7 +248,8 @@ def mock_session_request(*args, **kwargs):
248248 assert not rest ._connection .errorhandler .called
249249
250250
251- def test_auth_okta_step5_negative ():
251+ @pytest .mark .parametrize ("disable_saml_url_check" , [True , False ])
252+ def test_auth_okta_step5_negative (disable_saml_url_check ):
252253 """Authentication by OKTA step5 negative test case."""
253254 authenticator = "https://testsso.snowflake.net/"
254255 application = "testapplication"
@@ -259,7 +260,9 @@ def test_auth_okta_step5_negative():
259260
260261 ref_sso_url = "https://testsso.snowflake.net/sso"
261262 ref_token_url = "https://testsso.snowflake.net/token"
262- rest = _init_rest (ref_sso_url , ref_token_url )
263+ rest = _init_rest (
264+ ref_sso_url , ref_token_url , disable_saml_url_check = disable_saml_url_check
265+ )
263266
264267 auth = AuthByOkta (application )
265268 # step 1
@@ -306,10 +309,12 @@ def get_one_time_token():
306309 rest ._host = f"{ account } .snowflakecomputing.com"
307310 rest ._port = 443
308311 auth ._step5 (rest ._connection , ref_response_html )
309- assert rest ._connection .errorhandler .called # error
312+ assert disable_saml_url_check ^ rest ._connection .errorhandler .called # error
310313
311314
312- def _init_rest (ref_sso_url , ref_token_url , success = True , message = None ):
315+ def _init_rest (
316+ ref_sso_url , ref_token_url , success = True , message = None , disable_saml_url_check = False
317+ ):
313318 def post_request (url , headers , body , ** kwargs ):
314319 _ = url
315320 _ = headers
@@ -324,7 +329,7 @@ def post_request(url, headers, body, **kwargs):
324329 },
325330 }
326331
327- connection = mock_connection ()
332+ connection = mock_connection (disable_saml_url_check = disable_saml_url_check )
328333 connection .errorhandler = Mock (return_value = None )
329334 connection ._ocsp_mode = Mock (return_value = OCSPMode .FAIL_OPEN )
330335 type(connection ).application = PropertyMock (return_value = CLIENT_NAME )
0 commit comments