From f4515696024b2680f751fe2395ea2a427ac137f3 Mon Sep 17 00:00:00 2001 From: Roland Hedberg Date: Wed, 2 Apr 2014 13:31:26 +0200 Subject: [PATCH] Editorial --- tests/server_conf.py | 21 +++++++++++---------- tests/test_20_assertion.py | 15 ++++++++++----- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/tests/server_conf.py b/tests/server_conf.py index c01385b..2ff8f6d 100644 --- a/tests/server_conf.py +++ b/tests/server_conf.py @@ -2,8 +2,8 @@ from pathutils import full_path from pathutils import xmlsec_path CONFIG = { - "entityid" : "urn:mace:example.com:saml:roland:sp", - "name" : "urn:mace:example.com:saml:roland:sp", + "entityid": "urn:mace:example.com:saml:roland:sp", + "name": "urn:mace:example.com:saml:roland:sp", "description": "My own SP", "service": { "sp": { @@ -25,14 +25,14 @@ CONFIG = { "local": [full_path("idp.xml"), full_path("vo_metadata.xml")], }, "virtual_organization": { - "urn:mace:example.com:it:tek":{ + "urn:mace:example.com:it:tek": { "nameid_format": "urn:oid:1.3.6.1.4.1.1466.115.121.1.15-NameID", "common_identifier": "umuselin", } }, "subject_data": "subject_data.db", "accepted_time_diff": 60, - "attribute_map_dir" : full_path("attributemaps"), + "attribute_map_dir": full_path("attributemaps"), "valid_for": 6, "organization": { "name": ("AB Exempel", "se"), @@ -40,12 +40,13 @@ CONFIG = { "url": "http://www.example.org", }, "contact_person": [{ - "given_name": "Roland", - "sur_name": "Hedberg", - "telephone_number": "+46 70 100 0000", - "email_address": ["tech@eample.com", "tech@example.org"], - "contact_type": "technical" - }, + "given_name": "Roland", + "sur_name": "Hedberg", + "telephone_number": "+46 70 100 0000", + "email_address": ["tech@eample.com", + "tech@example.org"], + "contact_type": "technical" + }, ], "logger": { "rotating": { diff --git a/tests/test_20_assertion.py b/tests/test_20_assertion.py index 5826d5f..4c65438 100644 --- a/tests/test_20_assertion.py +++ b/tests/test_20_assertion.py @@ -1,3 +1,4 @@ +# coding=utf-8 from saml2.authn_context import pword from saml2.mdie import to_dict from saml2 import md, assertion @@ -75,7 +76,6 @@ def test_filter_on_attributes_1(): assert ava.keys() == ["serialNumber"] assert ava["serialNumber"] == ["12345"] - # ---------------------------------------------------------------------- def test_lifetime_1(): @@ -255,6 +255,7 @@ def test_filter_attribute_value_assertions_2(AVA): assert _eq(ava.keys(), ["givenName"]) assert ava["givenName"] == ["Roland"] + # ---------------------------------------------------------------------------- @@ -290,7 +291,9 @@ def test_assertion_1(AVA): def test_assertion_2(): AVA = {'mail': u'roland.hedberg@adm.umu.se', - 'eduPersonTargetedID': 'http://lingon.ladok.umu.se:8090/idp!http://lingon.ladok.umu.se:8088/sp!95e9ae91dbe62d35198fbbd5e1fb0976', + 'eduPersonTargetedID': 'http://lingon.ladok.umu' + '.se:8090/idp!http://lingon.ladok.umu' + '.se:8088/sp!95e9ae91dbe62d35198fbbd5e1fb0976', 'displayName': u'Roland Hedberg', 'uid': 'http://roland.hedberg.myopenid.com/'} @@ -453,6 +456,7 @@ def test_filter_values_req_opt_2(): raises(MissingValue, "filter_on_attributes(ava, r, o)") + # --------------------------------------------------------------------------- @@ -485,6 +489,7 @@ def test_filter_values_req_opt_4(): assert _eq(ava.keys(), ['givenName', 'sn']) assert ava == {'givenName': ['Roland'], 'sn': ['Hedberg']} + # --------------------------------------------------------------------------- @@ -706,7 +711,7 @@ ACD = pword.AuthenticationContextDeclaration(authn_method=authn_method) def test_assertion_with_noop_attribute_conv(): - ava = {"urn:oid:2.5.4.4": "Roland", "urn:oid:2.5.4.42": "Hedberg" } + ava = {"urn:oid:2.5.4.4": "Roland", "urn:oid:2.5.4.42": "Hedberg"} ast = Assertion(ava) policy = Policy({ "default": { @@ -719,7 +724,7 @@ def test_assertion_with_noop_attribute_conv(): issuer = Issuer(text="entityid", format=NAMEID_FORMAT_ENTITY) msg = ast.construct("sp_entity_id", "in_response_to", "consumer_url", name_id, [AttributeConverterNOOP(NAME_FORMAT_URI)], - policy, issuer=issuer, authn_decl=ACD , + policy, issuer=issuer, authn_decl=ACD, authn_auth="authn_authn") print msg @@ -767,7 +772,7 @@ def test_assertion_with_zero_attributes(): issuer = Issuer(text="entityid", format=NAMEID_FORMAT_ENTITY) msg = ast.construct("sp_entity_id", "in_response_to", "consumer_url", name_id, [AttributeConverterNOOP(NAME_FORMAT_URI)], - policy, issuer=issuer, authn_decl=ACD , + policy, issuer=issuer, authn_decl=ACD, authn_auth="authn_authn") print msg