From a0c3bb297219a7bba65adc8b2de2402445a0c8b7 Mon Sep 17 00:00:00 2001 From: Roland Hedberg Date: Tue, 12 Oct 2010 08:55:23 +0200 Subject: [PATCH] Allow for more than one endpoint on a service, possibly with different binding --- tests/test_31_config.py | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/tests/test_31_config.py b/tests/test_31_config.py index 580aa7f..aaecf8a 100644 --- a/tests/test_31_config.py +++ b/tests/test_31_config.py @@ -1,6 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- +from saml2 import BINDING_HTTP_REDIRECT from saml2.config import Config from saml2.metadata import MetaData from py.test import raises @@ -75,6 +76,31 @@ IDP1 = { "xmlsec_binary" : "/usr/local/bin/xmlsec1", } +IDP2 = { + "entityid" : "urn:mace:umu.se:saml:roland:idp", + "service": { + "idp":{ + "name" : "Rolands IdP", + "endpoints": { + "single_sign_on_service" : ["http://localhost:8088/"], + "single_logout_service" : [("http://localhost:8088/", BINDING_HTTP_REDIRECT)], + }, + "assertions":{ + "default": { + "attribute_restrictions": { + "givenName": None, + "surName": None, + "eduPersonAffiliation": ["(member|staff)"], + "mail": [".*@example.com"], + } + }, + "urn:mace:umu.se:saml:roland:sp": None + } + } + }, + "xmlsec_binary" : "/usr/local/bin/xmlsec1", +} + def _eq(l1,l2): return set(l1) == set(l2) @@ -164,7 +190,7 @@ def test_minimum(): assert c != None -def test_idp(): +def test_idp_1(): c = Config().load(IDP1) print c @@ -173,6 +199,17 @@ def test_idp(): attribute_restrictions = c.idp_policy().get_attribute_restriction("") assert attribute_restrictions["eduPersonAffiliation"][0].match("staff") + +def test_idp_2(): + c = Config().load(IDP2) + + print c + assert c.services() == ["idp"] + assert c.endpoint("idp", "single_logout_service") == [] # default is SOAP + assert c.endpoint("idp", "single_logout_service", BINDING_HTTP_REDIRECT) == ['http://localhost:8088/'] + + attribute_restrictions = c.idp_policy().get_attribute_restriction("") + assert attribute_restrictions["eduPersonAffiliation"][0].match("staff") def test_wayf(): c = Config().load_file("server.config")