@@ -103,19 +103,19 @@ def get_path_from_url(url):
103103 for endp in all_sp_endpoints :
104104 assert any (p .match (endp ) for p in compiled_regex )
105105
106- def test_start_auth_defaults_to_redirecting_to_discovery_server (self , context , sp_conf ):
106+ def test_start_auth_defaults_to_redirecting_to_discovery_server (self , context , sp_conf , ** kwargs ):
107107 resp = self .samlbackend .start_auth (context , InternalData ())
108108 assert_redirect_to_discovery_server (resp , sp_conf , DISCOSRV_URL )
109109
110- def test_discovery_server_set_in_context (self , context , sp_conf ):
110+ def test_discovery_server_set_in_context (self , context , sp_conf , ** kwargs ):
111111 discosrv_url = 'https://my.org/saml_discovery_service'
112112 context .decorate (
113113 SAMLBackend .KEY_SAML_DISCOVERY_SERVICE_URL , discosrv_url
114114 )
115115 resp = self .samlbackend .start_auth (context , InternalData ())
116116 assert_redirect_to_discovery_server (resp , sp_conf , discosrv_url )
117117
118- def test_full_flow (self , context , idp_conf , sp_conf ):
118+ def test_full_flow (self , context , idp_conf , sp_conf , ** kwargs ):
119119 test_state_key = "test_state_key_456afgrh"
120120 response_binding = BINDING_HTTP_REDIRECT
121121 fakeidp = FakeIdP (USERS , config = IdPConfig ().load (idp_conf , metadata_construction = False ))
@@ -165,21 +165,21 @@ def test_start_auth_redirects_directly_to_mirrored_idp(
165165 resp = self .samlbackend .start_auth (context , InternalData ())
166166 assert_redirect_to_idp (resp , idp_conf )
167167
168- def test_redirect_to_idp_if_only_one_idp_in_metadata (self , context , sp_conf , idp_conf ):
168+ def test_redirect_to_idp_if_only_one_idp_in_metadata (self , context , sp_conf , idp_conf , ** kwargs ):
169169 sp_conf ["metadata" ]["inline" ] = [create_metadata_from_config_dict (idp_conf )]
170170 # instantiate new backend, without any discovery service configured
171171 samlbackend = SAMLBackend (None , INTERNAL_ATTRIBUTES , {"sp_config" : sp_conf }, "base_url" , "saml_backend" )
172172
173173 resp = samlbackend .start_auth (context , InternalData ())
174174 assert_redirect_to_idp (resp , idp_conf )
175175
176- def test_authn_request (self , context , idp_conf ):
176+ def test_authn_request (self , context , idp_conf , ** kwargs ):
177177 resp = self .samlbackend .authn_request (context , idp_conf ["entityid" ])
178178 assert_redirect_to_idp (resp , idp_conf )
179179 req_params = dict (parse_qsl (urlparse (resp .message ).query ))
180180 assert context .state [self .samlbackend .name ]["relay_state" ] == req_params ["RelayState" ]
181181
182- def test_authn_response (self , context , idp_conf , sp_conf ):
182+ def test_authn_response (self , context , idp_conf , sp_conf , ** kwargs ):
183183 response_binding = BINDING_HTTP_REDIRECT
184184 fakesp = FakeSP (SPConfig ().load (sp_conf , metadata_construction = False ))
185185 fakeidp = FakeIdP (USERS , config = IdPConfig ().load (idp_conf , metadata_construction = False ))
@@ -199,7 +199,7 @@ def test_authn_response(self, context, idp_conf, sp_conf):
199199 @pytest .mark .skipif (
200200 saml2 .__version__ < '4.6.1' ,
201201 reason = "Optional NameID needs pysaml2 v4.6.1 or higher" )
202- def test_authn_response_no_name_id (self , context , idp_conf , sp_conf ):
202+ def test_authn_response_no_name_id (self , context , idp_conf , sp_conf , ** kwargs ):
203203 response_binding = BINDING_HTTP_REDIRECT
204204
205205 fakesp_conf = SPConfig ().load (sp_conf , metadata_construction = False )
@@ -232,7 +232,7 @@ def test_authn_response_no_name_id(self, context, idp_conf, sp_conf):
232232 assert_authn_response (internal_resp )
233233 assert backend .name not in context .state
234234
235- def test_authn_response_with_encrypted_assertion (self , sp_conf , context ):
235+ def test_authn_response_with_encrypted_assertion (self , sp_conf , context , ** kwargs ):
236236 with open (os .path .join (
237237 TEST_RESOURCE_BASE_PATH ,
238238 "idp_metadata_for_encrypted_signed_auth_response.xml"
@@ -277,28 +277,28 @@ def test_authn_response_with_encrypted_assertion(self, sp_conf, context):
277277 context , internal_resp = samlbackend .auth_callback_func .call_args [0 ]
278278 assert Counter (internal_resp .attributes .keys ()) == Counter ({"mail" , "givenname" , "displayname" , "surname" })
279279
280- def test_backend_reads_encryption_key_from_key_file (self , sp_conf ):
280+ def test_backend_reads_encryption_key_from_key_file (self , sp_conf , ** kwargs ):
281281 sp_conf ["key_file" ] = os .path .join (TEST_RESOURCE_BASE_PATH , "encryption_key.pem" )
282282 samlbackend = SAMLBackend (Mock (), INTERNAL_ATTRIBUTES , {"sp_config" : sp_conf ,
283283 "disco_srv" : DISCOSRV_URL },
284284 "base_url" , "samlbackend" )
285285 assert samlbackend .encryption_keys
286286
287- def test_backend_reads_encryption_key_from_encryption_keypair (self , sp_conf ):
287+ def test_backend_reads_encryption_key_from_encryption_keypair (self , sp_conf , ** kwargs ):
288288 del sp_conf ["key_file" ]
289289 sp_conf ["encryption_keypairs" ] = [{"key_file" : os .path .join (TEST_RESOURCE_BASE_PATH , "encryption_key.pem" )}]
290290 samlbackend = SAMLBackend (Mock (), INTERNAL_ATTRIBUTES , {"sp_config" : sp_conf ,
291291 "disco_srv" : DISCOSRV_URL },
292292 "base_url" , "samlbackend" )
293293 assert samlbackend .encryption_keys
294294
295- def test_metadata_endpoint (self , context , sp_conf ):
295+ def test_metadata_endpoint (self , context , sp_conf , ** kwargs ):
296296 resp = self .samlbackend ._metadata_endpoint (context )
297297 headers = dict (resp .headers )
298298 assert headers ["Content-Type" ] == "text/xml"
299299 assert sp_conf ["entityid" ] in resp .message
300300
301- def test_get_metadata_desc (self , sp_conf , idp_conf ):
301+ def test_get_metadata_desc (self , sp_conf , idp_conf , ** kwargs ):
302302 sp_conf ["metadata" ]["inline" ] = [create_metadata_from_config_dict (idp_conf )]
303303 # instantiate new backend, with a single backing IdP
304304 samlbackend = SAMLBackend (None , INTERNAL_ATTRIBUTES , {"sp_config" : sp_conf }, "base_url" , "saml_backend" )
@@ -321,7 +321,7 @@ def test_get_metadata_desc(self, sp_conf, idp_conf):
321321 assert ui_info ["description" ] == expected_ui_info ["description" ]
322322 assert ui_info ["logo" ] == expected_ui_info ["logo" ]
323323
324- def test_get_metadata_desc_with_logo_without_lang (self , sp_conf , idp_conf ):
324+ def test_get_metadata_desc_with_logo_without_lang (self , sp_conf , idp_conf , ** kwargs ):
325325 # add logo without 'lang'
326326 idp_conf ["service" ]["idp" ]["ui_info" ]["logo" ] = [{"text" : "https://idp.example.com/static/logo.png" ,
327327 "width" : "120" , "height" : "60" }]
@@ -351,8 +351,7 @@ def test_get_metadata_desc_with_logo_without_lang(self, sp_conf, idp_conf):
351351
352352class TestSAMLBackendRedirects :
353353 def test_default_redirect_to_discovery_service_if_using_mdq (
354- self , context , sp_conf , idp_conf
355- ):
354+ self , context , sp_conf , idp_conf , ** kwargs ):
356355 # one IdP in the metadata, but MDQ also configured so should always redirect to the discovery service
357356 sp_conf ["metadata" ]["inline" ] = [create_metadata_from_config_dict (idp_conf )]
358357 sp_conf ["metadata" ]["mdq" ] = ["https://mdq.example.com" ]
@@ -362,8 +361,7 @@ def test_default_redirect_to_discovery_service_if_using_mdq(
362361 assert_redirect_to_discovery_server (resp , sp_conf , DISCOSRV_URL )
363362
364363 def test_use_of_disco_or_redirect_to_idp_when_using_mdq_and_forceauthn_is_not_set (
365- self , context , sp_conf , idp_conf
366- ):
364+ self , context , sp_conf , idp_conf , ** kwargs ):
367365 sp_conf ["metadata" ]["inline" ] = [create_metadata_from_config_dict (idp_conf )]
368366 sp_conf ["metadata" ]["mdq" ] = ["https://mdq.example.com" ]
369367
@@ -402,8 +400,7 @@ def test_use_of_disco_or_redirect_to_idp_when_using_mdq_and_forceauthn_is_not_se
402400 assert_redirect_to_discovery_server (resp , sp_conf , DISCOSRV_URL )
403401
404402 def test_use_of_disco_or_redirect_to_idp_when_using_mdq_and_forceauthn_is_set_true (
405- self , context , sp_conf , idp_conf
406- ):
403+ self , context , sp_conf , idp_conf , ** kwargs ):
407404 sp_conf ["metadata" ]["inline" ] = [create_metadata_from_config_dict (idp_conf )]
408405 sp_conf ["metadata" ]["mdq" ] = ["https://mdq.example.com" ]
409406
@@ -430,8 +427,7 @@ def test_use_of_disco_or_redirect_to_idp_when_using_mdq_and_forceauthn_is_set_tr
430427 assert_redirect_to_idp (resp , idp_conf )
431428
432429 def test_use_of_disco_or_redirect_to_idp_when_using_mdq_and_forceauthn_is_set_1 (
433- self , context , sp_conf , idp_conf
434- ):
430+ self , context , sp_conf , idp_conf , ** kwargs ):
435431 sp_conf ["metadata" ]["inline" ] = [create_metadata_from_config_dict (idp_conf )]
436432 sp_conf ["metadata" ]["mdq" ] = ["https://mdq.example.com" ]
437433
0 commit comments