diff options
author | Roland Hedberg <roland.hedberg@adm.umu.se> | 2014-07-19 09:52:56 -0700 |
---|---|---|
committer | Roland Hedberg <roland.hedberg@adm.umu.se> | 2014-07-19 09:52:56 -0700 |
commit | 4b6e35c70157840829a466ee0575a2ff27df841e (patch) | |
tree | 2845561324a74353e388f5a35f200a2b0e3fe8ec | |
parent | a34f2d1a07a2840dd338eb1805751d0a5df047a4 (diff) | |
download | pysaml2-4b6e35c70157840829a466ee0575a2ff27df841e.tar.gz |
Got the tests working.
-rw-r--r-- | example/sp-wsgi/sp.xml | 125 | ||||
-rw-r--r-- | tests/fakeIDP.py | 10 | ||||
-rw-r--r-- | tests/test_51_client.py | 4 | ||||
-rw-r--r-- | tests/test_67_manage_name_id.py | 2 |
4 files changed, 40 insertions, 101 deletions
diff --git a/example/sp-wsgi/sp.xml b/example/sp-wsgi/sp.xml index db3c6df9..6c28d9c0 100644 --- a/example/sp-wsgi/sp.xml +++ b/example/sp-wsgi/sp.xml @@ -1,93 +1,34 @@ <?xml version='1.0' encoding='UTF-8'?> -<ns0:EntityDescriptor xmlns:ns0="urn:oasis:names:tc:SAML:2.0:metadata" - xmlns:ns1="urn:oasis:names:tc:SAML:metadata:attribute" - xmlns:ns2="urn:oasis:names:tc:SAML:2.0:assertion" - xmlns:ns4="http://www.w3.org/2000/09/xmldsig#" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - entityID="http://localhost:8087/sp.xml"> - <ns0:Extensions> - <ns1:EntityAttributes> - <ns2:Attribute Name="http://macedir.org/entity-category"> - <ns2:AttributeValue xsi:type="xs:string"> - http://www.geant.net/uri/dataprotection-code-of-conduct/v1 - </ns2:AttributeValue> - </ns2:Attribute> - </ns1:EntityAttributes> - </ns0:Extensions> - <ns0:SPSSODescriptor AuthnRequestsSigned="false" WantAssertionsSigned="true" - protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol"> - <ns0:KeyDescriptor use="encryption"> - <ns4:KeyInfo> - <ns4:X509Data> - <ns4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:X509Data> - </ns4:KeyInfo> - </ns0:KeyDescriptor> - <ns0:KeyDescriptor use="signing"> - <ns4:KeyInfo> - <ns4:X509Data> - <ns4:X509Certificate> - MIIC8jCCAlugAwIBAgIJAJHg2V5J31I8MA0GCSqGSIb3DQEBBQUAMFoxCzAJBgNV - BAYTAlNFMQ0wCwYDVQQHEwRVbWVhMRgwFgYDVQQKEw9VbWVhIFVuaXZlcnNpdHkx - EDAOBgNVBAsTB0lUIFVuaXQxEDAOBgNVBAMTB1Rlc3QgU1AwHhcNMDkxMDI2MTMz - MTE1WhcNMTAxMDI2MTMzMTE1WjBaMQswCQYDVQQGEwJTRTENMAsGA1UEBxMEVW1l - YTEYMBYGA1UEChMPVW1lYSBVbml2ZXJzaXR5MRAwDgYDVQQLEwdJVCBVbml0MRAw - DgYDVQQDEwdUZXN0IFNQMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDkJWP7 - bwOxtH+E15VTaulNzVQ/0cSbM5G7abqeqSNSs0l0veHr6/ROgW96ZeQ57fzVy2MC - FiQRw2fzBs0n7leEmDJyVVtBTavYlhAVXDNa3stgvh43qCfLx+clUlOvtnsoMiiR - mo7qf0BoPKTj7c0uLKpDpEbAHQT4OF1HRYVxMwIDAQABo4G/MIG8MB0GA1UdDgQW - BBQ7RgbMJFDGRBu9o3tDQDuSoBy7JjCBjAYDVR0jBIGEMIGBgBQ7RgbMJFDGRBu9 - o3tDQDuSoBy7JqFepFwwWjELMAkGA1UEBhMCU0UxDTALBgNVBAcTBFVtZWExGDAW - BgNVBAoTD1VtZWEgVW5pdmVyc2l0eTEQMA4GA1UECxMHSVQgVW5pdDEQMA4GA1UE - AxMHVGVzdCBTUIIJAJHg2V5J31I8MAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEF - BQADgYEAMuRwwXRnsiyWzmRikpwinnhTmbooKm5TINPE7A7gSQ710RxioQePPhZO - zkM27NnHTrCe2rBVg0EGz7QTd1JIwLPvgoj4VTi/fSha/tXrYUaqc9AqU1kWI4WN - +vffBGQ09mo+6CffuFTZYeOhzP/2stAPwCTU4kxEoiy0KpZMANI= - </ns4:X509Certificate> - </ns4:X509Data> - </ns4:KeyInfo> - </ns0:KeyDescriptor> - <ns0:AssertionConsumerService - Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect" - Location="http://localhost:8087/acs/redirect" index="1"/> - <ns0:AssertionConsumerService - Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" - Location="http://localhost:8087/acs/post" index="2"/> - <ns0:AttributeConsumingService index="1"> - <ns0:ServiceName xml:lang="en">My SP service</ns0:ServiceName> - <ns0:ServiceDescription xml:lang="en">Example SP - </ns0:ServiceDescription> - <ns0:RequestedAttribute FriendlyName="sn" Name="urn:oid:2.5.4.4" - NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" - isRequired="true"/> - <ns0:RequestedAttribute FriendlyName="givenname" - Name="urn:oid:2.5.4.42" - NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" - isRequired="true"/> - <ns0:RequestedAttribute FriendlyName="edupersonaffiliation" - Name="urn:oid:1.3.6.1.4.1.5923.1.1.1.1" - NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" - isRequired="true"/> - <ns0:RequestedAttribute FriendlyName="title" Name="urn:oid:2.5.4.12" - NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" - isRequired="false"/> - </ns0:AttributeConsumingService> - </ns0:SPSSODescriptor> -</ns0:EntityDescriptor> +<ns0:EntityDescriptor xmlns:ns0="urn:oasis:names:tc:SAML:2.0:metadata" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ns1="urn:oasis:names:tc:SAML:metadata:attribute" xmlns:ns2="urn:oasis:names:tc:SAML:2.0:assertion" xmlns:ns4="http://www.w3.org/2000/09/xmldsig#" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" entityID="http://localhost:8087/sp.xml"><ns0:Extensions><ns1:EntityAttributes><ns2:Attribute Name="http://macedir.org/entity-category"><ns2:AttributeValue xsi:type="xs:string">http://www.geant.net/uri/dataprotection-code-of-conduct/v1</ns2:AttributeValue></ns2:Attribute></ns1:EntityAttributes></ns0:Extensions><ns0:SPSSODescriptor AuthnRequestsSigned="false" WantAssertionsSigned="true" protocolSupportEnumeration="urn:oasis:names:tc:SAML:2.0:protocol"><ns0:KeyDescriptor use="encryption"><ns4:KeyInfo><ns4:X509Data><ns4:X509Certificate>MIIC8jCCAlugAwIBAgIJAJHg2V5J31I8MA0GCSqGSIb3DQEBBQUAMFoxCzAJBgNV +BAYTAlNFMQ0wCwYDVQQHEwRVbWVhMRgwFgYDVQQKEw9VbWVhIFVuaXZlcnNpdHkx +EDAOBgNVBAsTB0lUIFVuaXQxEDAOBgNVBAMTB1Rlc3QgU1AwHhcNMDkxMDI2MTMz +MTE1WhcNMTAxMDI2MTMzMTE1WjBaMQswCQYDVQQGEwJTRTENMAsGA1UEBxMEVW1l +YTEYMBYGA1UEChMPVW1lYSBVbml2ZXJzaXR5MRAwDgYDVQQLEwdJVCBVbml0MRAw +DgYDVQQDEwdUZXN0IFNQMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDkJWP7 +bwOxtH+E15VTaulNzVQ/0cSbM5G7abqeqSNSs0l0veHr6/ROgW96ZeQ57fzVy2MC +FiQRw2fzBs0n7leEmDJyVVtBTavYlhAVXDNa3stgvh43qCfLx+clUlOvtnsoMiiR +mo7qf0BoPKTj7c0uLKpDpEbAHQT4OF1HRYVxMwIDAQABo4G/MIG8MB0GA1UdDgQW +BBQ7RgbMJFDGRBu9o3tDQDuSoBy7JjCBjAYDVR0jBIGEMIGBgBQ7RgbMJFDGRBu9 +o3tDQDuSoBy7JqFepFwwWjELMAkGA1UEBhMCU0UxDTALBgNVBAcTBFVtZWExGDAW +BgNVBAoTD1VtZWEgVW5pdmVyc2l0eTEQMA4GA1UECxMHSVQgVW5pdDEQMA4GA1UE +AxMHVGVzdCBTU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1VtZWEgVW5pdmVyc2l0eTEQMA4GA1UECxMHSVQgVW5pdDEQMA4GA1UE +AxMHVGVzdCBTUIIJAJHg2V5J31I8MAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEF +BQADgYEAMuRwwXRnsiyWzmRikpwinnhTmbooKm5TINPE7A7gSQ710RxioQePPhZO +zkM27NnHTrCe2rBVg0EGz7QTd1JIwLPvgoj4VTi/fSha/tXrYUaqc9AqU1kWI4WN ++vffBGQ09mo+6CffuFTZYeOhzP/2stAPwCTU4kxEoiy0KpZMANI= +</ns4:X509Certificate></ns4:X509Data></ns4:KeyInfo></ns0:KeyDescriptor><ns0:AssertionConsumerService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect" Location="http://localhost:8087/acs/redirect" index="1" /><ns0:AttributeConsumingService index="1"><ns0:ServiceName xml:lang="en">My SP service</ns0:ServiceName><ns0:ServiceDescription xml:lang="en">Example SP</ns0:ServiceDescription><ns0:RequestedAttribute FriendlyName="sn" Name="urn:oid:2.5.4.4" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" isRequired="true" /><ns0:RequestedAttribute FriendlyName="givenname" Name="urn:oid:2.5.4.42" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" isRequired="true" /><ns0:RequestedAttribute FriendlyName="edupersonaffiliation" Name="urn:oid:1.3.6.1.4.1.5923.1.1.1.1" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" isRequired="true" /><ns0:RequestedAttribute FriendlyName="title" Name="urn:oid:2.5.4.12" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:uri" isRequired="false" /></ns0:AttributeConsumingService></ns0:SPSSODescriptor></ns0:EntityDescriptor> diff --git a/tests/fakeIDP.py b/tests/fakeIDP.py index 3fd25a73..1df910e2 100644 --- a/tests/fakeIDP.py +++ b/tests/fakeIDP.py @@ -47,6 +47,7 @@ class DummyResponse(object): self.status_code = code self.text = data self.headers = headers or [] + self.content = data class FakeIDP(Server): @@ -142,12 +143,9 @@ class FakeIDP(Server): #userid = "Pavill" name_id = aquery.subject.name_id - attr_resp = self.create_attribute_response(extra, aquery.id, - None, - sp_entity_id=aquery.issuer - .text, - name_id=name_id, - attributes=aquery.attribute) + attr_resp = self.create_attribute_response( + extra, aquery.id, None, sp_entity_id=aquery.issuer.text, + name_id=name_id, attributes=aquery.attribute) if binding == BINDING_SOAP: # SOAP packing diff --git a/tests/test_51_client.py b/tests/test_51_client.py index 11b5cd09..6b93e455 100644 --- a/tests/test_51_client.py +++ b/tests/test_51_client.py @@ -593,6 +593,6 @@ class TestClientWithDummy(): # tc.test_response() if __name__ == "__main__": - tc = TestClient() + tc = TestClientWithDummy() tc.setup_class() - tc.test_sign_then_encrypt_assertion2() + tc.test_do_attribute_query() diff --git a/tests/test_67_manage_name_id.py b/tests/test_67_manage_name_id.py index 7c1dc748..f0e41fb5 100644 --- a/tests/test_67_manage_name_id.py +++ b/tests/test_67_manage_name_id.py @@ -55,7 +55,7 @@ def test_flow(): print _req.message - mnir = idp.create_manage_name_id_response(_req.message, None) + mnir = idp.create_manage_name_id_response(_req.message, [binding]) if binding != BINDING_SOAP: binding, destination = idp.pick_binding("manage_name_id_service", |