diff options
Diffstat (limited to 'tests/test_71_authn_request.py')
-rw-r--r-- | tests/test_71_authn_request.py | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/tests/test_71_authn_request.py b/tests/test_71_authn_request.py index ee970923..6ee609e3 100644 --- a/tests/test_71_authn_request.py +++ b/tests/test_71_authn_request.py @@ -1,6 +1,7 @@ from contextlib import closing from saml2.client import Saml2Client from saml2.server import Server +from saml2.saml import AuthnContextClassRef def test_authn_request_with_acs_by_index(): @@ -15,22 +16,30 @@ def test_authn_request_with_acs_by_index(): # instead of AssertionConsumerServiceURL. The index with label ACS_INDEX # exists in the SP metadata in servera.xml. request_id, authn_request = sp.create_authn_request( - sp.config.entityid, - assertion_consumer_service_index=ACS_INDEX) + sp.config.entityid, assertion_consumer_service_index=ACS_INDEX + ) - # Make sure the authn_request contains AssertionConsumerServiceIndex. - acs_index = getattr(authn_request, - 'assertion_consumer_service_index', None) + assert authn_request.requested_authn_context.authn_context_class_ref == [ + AuthnContextClassRef(accr) + for accr in sp.config.getattr("requested_authn_context").get("authn_context_class_ref") + ] + assert authn_request.requested_authn_context.comparison == ( + sp.config.getattr("requested_authn_context").get("comparison") + ) + # Make sure the authn_request contains AssertionConsumerServiceIndex. + acs_index = getattr( + authn_request, 'assertion_consumer_service_index', None + ) assert acs_index == ACS_INDEX # Create IdP. with closing(Server(config_file="idp_all_conf")) as idp: - # Ask the IdP to pick out the binding and destination from the # authn_request. - binding, destination = idp.pick_binding("assertion_consumer_service", - request=authn_request) + binding, destination = idp.pick_binding( + "assertion_consumer_service", request=authn_request + ) # Make sure the IdP pick_binding method picks the correct location # or destination based on the ACS index in the authn request. |