Merge pull request #83 from novapost/update_tests

Update tests
This commit is contained in:
Roland Hedberg
2014-02-27 06:16:40 -08:00
9 changed files with 70321 additions and 20 deletions

View File

@@ -492,7 +492,7 @@ class MetaDataMD(MetaData):
Handles locally stored metadata, the file format is the text representation Handles locally stored metadata, the file format is the text representation
of the Python representation of the metadata. of the Python representation of the metadata.
""" """
def __init__(self, onts, attrc, filenamen, **kwargs): def __init__(self, onts, attrc, filename, **kwargs):
MetaData.__init__(self, onts, attrc, **kwargs) MetaData.__init__(self, onts, attrc, **kwargs)
self.filename = filename self.filename = filename

View File

@@ -153,7 +153,8 @@ class IdentMDB(IdentDB):
self.mdb.store(ident, name_id=to_dict(name_id, ONTS.values(), True)) self.mdb.store(ident, name_id=to_dict(name_id, ONTS.values(), True))
def find_nameid(self, userid, nformat=None, sp_name_qualifier=None, def find_nameid(self, userid, nformat=None, sp_name_qualifier=None,
name_qualifier=None, sp_provided_id=None): name_qualifier=None, sp_provided_id=None, **kwargs):
# reset passed for compatibility kwargs for next usage
kwargs = {} kwargs = {}
if nformat: if nformat:
kwargs["name_format"] = nformat kwargs["name_format"] = nformat

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?><EntitiesDescriptor xmlns="urn:oasis:names:tc:SAML:2.0:metadata" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:shibmd="urn:mace:shibboleth:metadata:1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ID="INC20140204T195141" Name="urn:mace:incommon" validUntil="2014-02-18T10:00:00Z" xsi:schemaLocation="urn:oasis:names:tc:SAML:2.0:metadata sstc-saml-schema-metadata-2.0.xsd urn:mace:shibboleth:metadata:1.0 shibboleth-metadata-1.0.xsd http://www.w3.org/2000/09/xmldsig# xmldsig-core-schema.xsd"><ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#"> <?xml version="1.0" encoding="UTF-8"?><EntitiesDescriptor xmlns="urn:oasis:names:tc:SAML:2.0:metadata" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:shibmd="urn:mace:shibboleth:metadata:1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ID="INC20140204T195141" Name="urn:mace:incommon" validUntil="2020-02-18T10:00:00Z" xsi:schemaLocation="urn:oasis:names:tc:SAML:2.0:metadata sstc-saml-schema-metadata-2.0.xsd urn:mace:shibboleth:metadata:1.0 shibboleth-metadata-1.0.xsd http://www.w3.org/2000/09/xmldsig# xmldsig-core-schema.xsd"><ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:SignedInfo> <ds:SignedInfo>
<ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/> <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
<ds:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/> <ds:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/>

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?><EntitiesDescriptor xmlns="urn:oasis:names:tc:SAML:2.0:metadata" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:mdrpi="urn:oasis:names:tc:SAML:metadata:rpi" xmlns:mdui="urn:oasis:names:tc:SAML:metadata:ui" xmlns:shibmd="urn:mace:shibboleth:metadata:1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ID="AAITest-20140205105921" Name="urn:mace:switch.ch:aaitest" validUntil="2014-02-10T09:59:21Z" xsi:schemaLocation="urn:oasis:names:tc:SAML:2.0:metadata saml-schema-metadata-2.0.xsd urn:mace:shibboleth:metadata:1.0 shibboleth-metadata-1.0.xsd http://www.w3.org/2000/09/xmldsig# xmldsig-core-schema.xsd"><ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#"> <?xml version="1.0" encoding="UTF-8"?><EntitiesDescriptor xmlns="urn:oasis:names:tc:SAML:2.0:metadata" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:mdrpi="urn:oasis:names:tc:SAML:metadata:rpi" xmlns:mdui="urn:oasis:names:tc:SAML:metadata:ui" xmlns:shibmd="urn:mace:shibboleth:metadata:1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ID="AAITest-20140205105921" Name="urn:mace:switch.ch:aaitest" validUntil="2020-02-10T09:59:21Z" xsi:schemaLocation="urn:oasis:names:tc:SAML:2.0:metadata saml-schema-metadata-2.0.xsd urn:mace:shibboleth:metadata:1.0 shibboleth-metadata-1.0.xsd http://www.w3.org/2000/09/xmldsig# xmldsig-core-schema.xsd"><ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
<ds:SignedInfo> <ds:SignedInfo>
<ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/> <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
<ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/> <ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>

70292
tests/swamid-2.0.xml Normal file

File diff suppressed because one or more lines are too long

View File

@@ -39,9 +39,11 @@ class TestAC():
for ac in self.acs: for ac in self.acs:
try: try:
ava = ac.fro(ats) ava = ac.fro(ats)
break
except attribute_converter.UnknownNameFormat: except attribute_converter.UnknownNameFormat:
pass pass
# break if we have something
if ava:
break
print ava.keys() print ava.keys()
assert _eq(ava.keys(), ['givenName', 'displayName', 'uid', assert _eq(ava.keys(), ['givenName', 'displayName', 'uid',
'eduPersonNickname', 'street', 'eduPersonNickname', 'street',

View File

@@ -96,6 +96,7 @@ class TestIdentifier():
assert _eq(nameid.keyswv(), ['text', 'format', 'sp_name_qualifier', assert _eq(nameid.keyswv(), ['text', 'format', 'sp_name_qualifier',
'name_qualifier']) 'name_qualifier'])
assert nameid.format == NAMEID_FORMAT_TRANSIENT assert nameid.format == NAMEID_FORMAT_TRANSIENT
assert nameid.text != "foobar"
def test_vo_1(self): def test_vo_1(self):
policy = Policy({ policy = Policy({
@@ -119,7 +120,8 @@ class TestIdentifier():
'name_qualifier']) 'name_qualifier'])
assert nameid.sp_name_qualifier == 'http://vo.example.org/biomed' assert nameid.sp_name_qualifier == 'http://vo.example.org/biomed'
assert nameid.format == NAMEID_FORMAT_PERSISTENT assert nameid.format == NAMEID_FORMAT_PERSISTENT
assert nameid.text != "foobar" # we want to keep the user identifier in the nameid node
assert nameid.text == "foobar"
def test_vo_2(self): def test_vo_2(self):
policy = Policy({ policy = Policy({

View File

@@ -74,7 +74,7 @@ def test_metadata():
assert len(certs) == 1 assert len(certs) == 1
sps = mds.with_descriptor("spsso") sps = mds.with_descriptor("spsso")
assert len(sps) == 418 assert len(sps) == 417
wants = mds.attribute_requirement('https://connect.sunet.se/shibboleth') wants = mds.attribute_requirement('https://connect.sunet.se/shibboleth')
assert wants["optional"] == [] assert wants["optional"] == []

View File

@@ -52,17 +52,21 @@ MDIMPORT = {
} }
item = MDIMPORT[sys.argv[1]] def main():
item = MDIMPORT[sys.argv[1]]
metad = None metad = None
if item["type"] == "local": if item["type"] == "local":
metad = MetaDataFile(sys.argv[1], ONTS.values(), item["file"]) metad = MetaDataFile(sys.argv[1], ONTS.values(), item["file"])
elif item["type"] == "external": elif item["type"] == "external":
metad = MetaDataExtern(sys.argv[1], ONTS.values(), metad = MetaDataExtern(sys.argv[1], ONTS.values(),
item["url"], "/opt/local/bin/xmlsec1", item["cert"]) item["url"], "/opt/local/bin/xmlsec1", item["cert"])
if metad: if metad:
metad.load() metad.load()
print metad.dumps() print metad.dumps()
if __name__ == '__main__':
main()