diff options
author | Roland Hedberg <roland.hedberg@adm.umu.se> | 2013-01-31 14:07:55 +0100 |
---|---|---|
committer | Roland Hedberg <roland.hedberg@adm.umu.se> | 2013-01-31 14:07:55 +0100 |
commit | d1523b6d5e8d34c81fc105e12ca2d8d8a90b67f9 (patch) | |
tree | 3fd7fce86c4496fd1a28b06f20e01e0e87678906 /tests/test_63_ecp.py | |
parent | 0ba327d6eb28dc1a13326da194df56f1af543253 (diff) | |
download | pysaml2-d1523b6d5e8d34c81fc105e12ca2d8d8a90b67f9.tar.gz |
Fixed all tests.
Shelve don't allow unicode strings as keys.
Diffstat (limited to 'tests/test_63_ecp.py')
-rw-r--r-- | tests/test_63_ecp.py | 73 |
1 files changed, 10 insertions, 63 deletions
diff --git a/tests/test_63_ecp.py b/tests/test_63_ecp.py index c60d8eac..15c5ee00 100644 --- a/tests/test_63_ecp.py +++ b/tests/test_63_ecp.py @@ -2,80 +2,27 @@ from saml2.saml import AUTHN_PASSWORD from saml2.httpbase import set_list2dict from saml2.profile.ecp import RelayState from saml2.profile.paos import Request -from saml2.request import AuthnRequest from saml2.server import Server -from saml2.samlp import Response, STATUS_SUCCESS - -__author__ = 'rolandh' - -from saml2 import soap, ecp_client, BINDING_SOAP, BINDING_PAOS, \ - create_class_from_xml_string -from saml2 import samlp -from saml2 import config -from saml2 import ecp +from saml2.samlp import Response +from saml2.samlp import STATUS_SUCCESS +from saml2.samlp import AuthnRequest +from saml2 import ecp_client +from saml2 import BINDING_SOAP +from saml2 import BINDING_PAOS +from saml2 import create_class_from_xml_string from saml2.profile import ecp as ecp_prof -from saml2.profile import paos from saml2.client import Saml2Client +__author__ = 'rolandh' + + def _eq(l1, l2): if len(l1) == len(l2): return set(l1) == set(l2) else: return len(l1) == len(l2) -def test_multiple_soap_headers(): - xml_str = open("ecp_soap.xml").read() - res = soap.class_instances_from_soap_enveloped_saml_thingies(xml_str, - [ecp_prof, - paos, - samlp]) - - assert res["body"].c_tag == "AuthnRequest" - - assert len(res["header"]) == 3 - headers = ["{%s}%s" % (i.c_namespace, i.c_tag) for i in res["header"]] - print headers - assert _eq(headers,['{urn:liberty:paos:2003-08}Request', - '{urn:oasis:names:tc:SAML:2.0:profiles:SSO:ecp}Request', - '{urn:oasis:names:tc:SAML:2.0:profiles:SSO:ecp}RelayState']) - - _relay_state = None - - for item in res["header"]: - if item.c_tag == "RelayState" and item.c_namespace == ecp_prof.NAMESPACE: - _relay_state = item - - assert _relay_state - assert _relay_state.actor == "http://schemas.xmlsoap.org/soap/actor/next" - -class TestECPClient(object): - def setup_class(self): - conf = config.SPConfig() - conf.load_file("server_conf") - self.client = Saml2Client(conf) - - def test_ecp_authn(self): - ssid, soap_req = ecp.ecp_auth_request(self.client, - "urn:mace:example.com:saml:roland:idp", - "id1") - print soap_req - response = soap.class_instances_from_soap_enveloped_saml_thingies( - soap_req, - [paos, - ecp_prof, - samlp]) - print response - assert len(response["header"]) == 2 - assert response["body"].c_tag == "AuthnRequest" - assert response["body"].c_namespace == samlp.NAMESPACE - headers = ["{%s}%s" % (i.c_namespace, - i.c_tag) for i in response["header"]] - print headers - assert _eq(headers,['{urn:liberty:paos:2003-08}Request', - #'{urn:oasis:names:tc:SAML:2.0:profiles:SSO:ecp}Request', - '{urn:oasis:names:tc:SAML:2.0:profiles:SSO:ecp}RelayState']) - try: from saml2.sigver import get_xmlsec_binary except ImportError: |