summaryrefslogtreecommitdiff
path: root/tests/test_37_entity_categories.py
diff options
context:
space:
mode:
authorRoland Hedberg <roland.hedberg@adm.umu.se>2013-11-18 12:52:03 +0100
committerRoland Hedberg <roland.hedberg@adm.umu.se>2013-11-18 12:52:03 +0100
commite9f34b70dba6bfa8f8ee913314b0f3ebd0114b2c (patch)
tree3723414584a791140ba68c2398f96499b9ab80b8 /tests/test_37_entity_categories.py
parent2d5ec644d7abebce85529705da98f61f6eaa57a9 (diff)
downloadpysaml2-e9f34b70dba6bfa8f8ee913314b0f3ebd0114b2c.tar.gz
Made SWAMIDs 2-dimensional entity category model work.
Diffstat (limited to 'tests/test_37_entity_categories.py')
-rw-r--r--tests/test_37_entity_categories.py47
1 files changed, 47 insertions, 0 deletions
diff --git a/tests/test_37_entity_categories.py b/tests/test_37_entity_categories.py
index 85c5cd70..e62118bc 100644
--- a/tests/test_37_entity_categories.py
+++ b/tests/test_37_entity_categories.py
@@ -102,6 +102,53 @@ def test_filter_ava3():
assert _eq(ava.keys(), ['eduPersonTargetedID', "norEduPersonNIN"])
+def test_filter_ava4():
+ policy = Policy({
+ "default": {
+ "lifetime": {"minutes": 15},
+ #"attribute_restrictions": None # means all I have
+ "entity_categories": ["swamid"]
+ }
+ })
+
+ mds = MetadataStore(ONTS.values(), ATTRCONV, sec_config,
+ disable_ssl_certificate_validation=True)
+ mds.imp({"local": [full_path("entity_cat_re_nren.xml")]})
+
+ ava = {"givenName": ["Derek"], "sn": ["Jeter"],
+ "mail": ["derek@nyy.mlb.com"], "c": ["USA"],
+ "eduPersonTargetedID": "foo!bar!xyz",
+ "norEduPersonNIN": "19800101134"}
+
+ ava = policy.filter(ava, "urn:mace:example.com:saml:roland:sp", mds)
+
+ assert _eq(ava.keys(), ['eduPersonTargetedID', "givenName", "c", "mail",
+ "sn"])
+
+
+def test_filter_ava5():
+ policy = Policy({
+ "default": {
+ "lifetime": {"minutes": 15},
+ #"attribute_restrictions": None # means all I have
+ "entity_categories": ["swamid"]
+ }
+ })
+
+ mds = MetadataStore(ONTS.values(), ATTRCONV, sec_config,
+ disable_ssl_certificate_validation=True)
+ mds.imp({"local": [full_path("entity_cat_re.xml")]})
+
+ ava = {"givenName": ["Derek"], "sn": ["Jeter"],
+ "mail": ["derek@nyy.mlb.com"], "c": ["USA"],
+ "eduPersonTargetedID": "foo!bar!xyz",
+ "norEduPersonNIN": "19800101134"}
+
+ ava = policy.filter(ava, "urn:mace:example.com:saml:roland:sp", mds)
+
+ assert _eq(ava.keys(), ['eduPersonTargetedID'])
+
+
def test_idp_policy_filter():
idp = Server("idp_conf_ec")