diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_30_mdstore.py | 17 | ||||
-rw-r--r-- | tests/test_30_mdstore_old.py | 17 | ||||
-rw-r--r-- | tests/test_50_server.py | 24 | ||||
-rw-r--r-- | tests/test_76_metadata_in_mdb.py | 4 |
4 files changed, 35 insertions, 27 deletions
diff --git a/tests/test_30_mdstore.py b/tests/test_30_mdstore.py index 59dc7da6..d712383f 100644 --- a/tests/test_30_mdstore.py +++ b/tests/test_30_mdstore.py @@ -15,7 +15,7 @@ from saml2.config import Config from saml2.mdstore import MetadataStore, MetaDataExtern from saml2.mdstore import MetaDataMDX from saml2.mdstore import SAML_METADATA_CONTENT_TYPE -from saml2.mdstore import destinations +from saml2.mdstore import locations from saml2.mdstore import name from saml2 import sigver from saml2.httpbase import HTTPBase @@ -177,8 +177,9 @@ def test_swami_1(): assert idps.keys() idpsso = mds.single_sign_on_service(UMU_IDP) assert len(idpsso) == 1 - assert destinations(idpsso) == [ - 'https://idp.umu.se/saml2/idp/SSOService.php'] + assert list(locations(idpsso)) == [ + 'https://idp.umu.se/saml2/idp/SSOService.php' + ] _name = name(mds[UMU_IDP]) assert _name == u'Umeå University (SAML2)' @@ -219,8 +220,9 @@ def test_incommon_1(): idpsso = mds.single_sign_on_service('urn:mace:incommon:alaska.edu') assert len(idpsso) == 1 print(idpsso) - assert destinations(idpsso) == [ - 'https://idp.alaska.edu/idp/profile/SAML2/Redirect/SSO'] + assert list(locations(idpsso)) == [ + 'https://idp.alaska.edu/idp/profile/SAML2/Redirect/SSO' + ] sps = mds.with_descriptor("spsso") @@ -279,8 +281,9 @@ def test_switch_1(): 'https://aai-demo-idp.switch.ch/idp/shibboleth') assert len(idpsso) == 1 print(idpsso) - assert destinations(idpsso) == [ - 'https://aai-demo-idp.switch.ch/idp/profile/SAML2/Redirect/SSO'] + assert list(locations(idpsso)) == [ + 'https://aai-demo-idp.switch.ch/idp/profile/SAML2/Redirect/SSO' + ] assert len(idps) > 30 aas = mds.with_descriptor("attribute_authority") print(aas.keys()) diff --git a/tests/test_30_mdstore_old.py b/tests/test_30_mdstore_old.py index 7ceb6653..d9f400ed 100644 --- a/tests/test_30_mdstore_old.py +++ b/tests/test_30_mdstore_old.py @@ -6,7 +6,7 @@ import os from unittest.mock import patch from saml2.mdstore import MetadataStore, MetaDataMDX -from saml2.mdstore import destinations +from saml2.mdstore import locations from saml2.mdstore import name from saml2 import md @@ -145,8 +145,9 @@ def test_swami_1(): assert idps.keys() idpsso = mds.single_sign_on_service(UMU_IDP) assert len(idpsso) == 1 - assert destinations(idpsso) == [ - 'https://idp.umu.se/saml2/idp/SSOService.php'] + assert list(locations(idpsso)) == [ + 'https://idp.umu.se/saml2/idp/SSOService.php' + ] _name = name(mds[UMU_IDP]) assert _name == u'Umeå University (SAML2)' @@ -187,8 +188,9 @@ def test_incommon_1(): idpsso = mds.single_sign_on_service('urn:mace:incommon:alaska.edu') assert len(idpsso) == 1 print(idpsso) - assert destinations(idpsso) == [ - 'https://idp.alaska.edu/idp/profile/SAML2/Redirect/SSO'] + assert list(locations(idpsso)) == [ + 'https://idp.alaska.edu/idp/profile/SAML2/Redirect/SSO' + ] sps = mds.with_descriptor("spsso") @@ -247,8 +249,9 @@ def test_switch_1(): 'https://aai-demo-idp.switch.ch/idp/shibboleth') assert len(idpsso) == 1 print(idpsso) - assert destinations(idpsso) == [ - 'https://aai-demo-idp.switch.ch/idp/profile/SAML2/Redirect/SSO'] + assert list(locations(idpsso)) == [ + 'https://aai-demo-idp.switch.ch/idp/profile/SAML2/Redirect/SSO' + ] assert len(idps) > 30 aas = mds.with_descriptor("attribute_authority") print(aas.keys()) diff --git a/tests/test_50_server.py b/tests/test_50_server.py index 93fbc6c6..2aee6d8a 100644 --- a/tests/test_50_server.py +++ b/tests/test_50_server.py @@ -2297,19 +2297,19 @@ def _logout_request(conf_file): class TestServerLogout(): - def test_1(self): with closing(Server("idp_slo_redirect_conf")) as server: req_id, request = _logout_request("sp_slo_redirect_conf") print(request) bindings = [BINDING_HTTP_REDIRECT] response = server.create_logout_response(request, bindings) - binding, destination = server.pick_binding("single_logout_service", - bindings, "spsso", - request, response=True) - http_args = server.apply_binding(binding, "%s" % response, destination, - "relay_state", response=True) + binding, destination = server.pick_binding( + "single_logout_service", bindings, "spsso", request + ) + http_args = server.apply_binding( + binding, "%s" % response, destination, "relay_state", response=True + ) assert len(http_args) == 4 assert http_args["headers"][0][0] == "Location" @@ -2322,18 +2322,20 @@ class TestServerLogout(): print(request) bindings = [BINDING_HTTP_POST] response = server.create_logout_response(request, bindings) - binding, destination = server.pick_binding("single_logout_service", - bindings, "spsso", - request, response=True) - http_args = server.apply_binding(binding, "%s" % response, destination, - "relay_state", response=True) + binding, destination = server.pick_binding( + "single_logout_service", bindings, "spsso", request + ) + http_args = server.apply_binding( + binding, "%s" % response, destination, "relay_state", response=True + ) assert len(http_args) == 4 assert len(http_args["data"]) > 0 assert http_args["method"] == "POST" assert http_args['url'] == 'http://lingon.catalogix.se:8087/slo' + if __name__ == "__main__": ts = TestServer1() ts.setup_class() diff --git a/tests/test_76_metadata_in_mdb.py b/tests/test_76_metadata_in_mdb.py index f1376b17..60c1ff1c 100644 --- a/tests/test_76_metadata_in_mdb.py +++ b/tests/test_76_metadata_in_mdb.py @@ -5,7 +5,7 @@ from saml2.attribute_converter import ac_factory from saml2.mongo_store import export_mdstore_to_mongo_db from saml2.mongo_store import MetadataMDB from saml2.mdstore import MetadataStore -from saml2.mdstore import destinations +from saml2.mdstore import locations from saml2.mdstore import name from saml2 import config from pathutils import full_path @@ -46,7 +46,7 @@ def test_metadata(): assert idps.keys() idpsso = mds.single_sign_on_service(umu_idp) assert len(idpsso) == 1 - assert destinations(idpsso) == [ + assert list(locations(idpsso)) == [ 'https://idp.umu.se/saml2/idp/SSOService.php'] _name = name(mds[umu_idp]) |