summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRebecka Gulliksson <rebecka.gulliksson@umu.se>2016-09-27 09:24:06 +0200
committerRebecka Gulliksson <rebecka.gulliksson@umu.se>2016-09-27 15:15:55 +0200
commit1891faa374a413eab52903365ac197b5999e1f5f (patch)
treeb905071a3723ff4a143cfc4b8858f2ad9910b387 /tests
parent17e6883bd76d90f572430228d98d87dd3b0a216f (diff)
downloadpysaml2-1891faa374a413eab52903365ac197b5999e1f5f.tar.gz
Automagically nest eduPersonTargetedID in a NameID.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_19_attribute_converter.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/tests/test_19_attribute_converter.py b/tests/test_19_attribute_converter.py
index 01960f6c..7c1951e4 100644
--- a/tests/test_19_attribute_converter.py
+++ b/tests/test_19_attribute_converter.py
@@ -5,10 +5,10 @@ from saml2 import attribute_converter, saml
from attribute_statement_data import *
from pathutils import full_path
-from saml2.attribute_converter import AttributeConverterNOOP
+from saml2.attribute_converter import AttributeConverterNOOP, from_local
from saml2.attribute_converter import AttributeConverter
from saml2.attribute_converter import to_local
-from saml2.saml import attribute_from_string
+from saml2.saml import attribute_from_string, name_id_from_string, NameID, NAMEID_FORMAT_PERSISTENT
from saml2.saml import attribute_statement_from_string
@@ -210,6 +210,13 @@ class TestAC():
attr_conv.adjust()
assert attr_conv._fro is None and attr_conv._to is None
+ def test_from_local_nest_eduPersonTargetedID_in_NameID(self):
+ ava = {"edupersontargetedid": "test value"}
+ attributes = from_local(self.acs, ava, URI_NF)
+ assert len(attributes) == 1
+ assert len(attributes[0].attribute_value) == 1
+ assert attributes[0].attribute_value[0].text == NameID(format=NAMEID_FORMAT_PERSISTENT, text="test value").to_string().decode("utf-8")
+
def test_noop_attribute_conversion():
ava = {"urn:oid:2.5.4.4": "Roland", "urn:oid:2.5.4.42": "Hedberg"}