Skip to content

Commit db91ff2

Browse files
author
Roland Hedberg
committed
Merge pull request #83 from novapost/update_tests
Update tests
2 parents 97c0693 + 034a9f5 commit db91ff2

9 files changed

+70321
-20
lines changed

src/saml2/mdstore.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ class MetaDataMD(MetaData):
492492
Handles locally stored metadata, the file format is the text representation
493493
of the Python representation of the metadata.
494494
"""
495-
def __init__(self, onts, attrc, filenamen, **kwargs):
495+
def __init__(self, onts, attrc, filename, **kwargs):
496496
MetaData.__init__(self, onts, attrc, **kwargs)
497497
self.filename = filename
498498

src/saml2/mongo_store.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,8 @@ def store(self, ident, name_id):
153153
self.mdb.store(ident, name_id=to_dict(name_id, ONTS.values(), True))
154154

155155
def find_nameid(self, userid, nformat=None, sp_name_qualifier=None,
156-
name_qualifier=None, sp_provided_id=None):
156+
name_qualifier=None, sp_provided_id=None, **kwargs):
157+
# reset passed for compatibility kwargs for next usage
157158
kwargs = {}
158159
if nformat:
159160
kwargs["name_format"] = nformat

tests/InCommon-metadata.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?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#">
1+
<?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#">
22
<ds:SignedInfo>
33
<ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
44
<ds:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/>
@@ -125457,4 +125457,4 @@ SF+p+s3fUvjA71QwrE3AjKXRHVUkTOk3cr79cC3vKw==
125457125457
<EmailAddress>[email protected]</EmailAddress>
125458125458
</ContactPerson>
125459125459
</EntityDescriptor>
125460-
</EntitiesDescriptor>
125460+
</EntitiesDescriptor>

tests/metadata.aaitest.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?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#">
1+
<?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#">
22
<ds:SignedInfo>
33
<ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
44
<ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
@@ -11793,4 +11793,4 @@ uO0GTCkBR4o9JvycnNPOWxknPccIms09elaAcgFDQ6o=
1179311793
<OrganizationURL xml:lang="en">http://www.aai-demo-idp.switch.ch/</OrganizationURL>
1179411794
</Organization>
1179511795
</EntityDescriptor>
11796-
</EntitiesDescriptor>
11796+
</EntitiesDescriptor>

tests/swamid-2.0.xml

Lines changed: 70292 additions & 0 deletions
Large diffs are not rendered by default.

tests/test_19_attribute_converter.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,11 @@ def test_ava_fro_1(self):
3939
for ac in self.acs:
4040
try:
4141
ava = ac.fro(ats)
42-
break
4342
except attribute_converter.UnknownNameFormat:
4443
pass
44+
# break if we have something
45+
if ava:
46+
break
4547
print ava.keys()
4648
assert _eq(ava.keys(), ['givenName', 'displayName', 'uid',
4749
'eduPersonNickname', 'street',
@@ -207,4 +209,4 @@ def test_noop_attribute_conversion():
207209
t = TestAC()
208210
t.setup_class()
209211
t.test_mixed_attributes_1()
210-
#test_noop_attribute_conversion()
212+
#test_noop_attribute_conversion()

tests/test_33_identifier.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ def test_transient_1(self):
9696
assert _eq(nameid.keyswv(), ['text', 'format', 'sp_name_qualifier',
9797
'name_qualifier'])
9898
assert nameid.format == NAMEID_FORMAT_TRANSIENT
99+
assert nameid.text != "foobar"
99100

100101
def test_vo_1(self):
101102
policy = Policy({
@@ -119,7 +120,8 @@ def test_vo_1(self):
119120
'name_qualifier'])
120121
assert nameid.sp_name_qualifier == 'http://vo.example.org/biomed'
121122
assert nameid.format == NAMEID_FORMAT_PERSISTENT
122-
assert nameid.text != "foobar"
123+
# we want to keep the user identifier in the nameid node
124+
assert nameid.text == "foobar"
123125

124126
def test_vo_2(self):
125127
policy = Policy({

tests/test_76_metadata_in_mdb.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def test_metadata():
7474
assert len(certs) == 1
7575

7676
sps = mds.with_descriptor("spsso")
77-
assert len(sps) == 418
77+
assert len(sps) == 417
7878

7979
wants = mds.attribute_requirement('https://connect.sunet.se/shibboleth')
8080
assert wants["optional"] == []

tools/mdexport_test.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,21 @@
5252
}
5353

5454

55-
item = MDIMPORT[sys.argv[1]]
55+
def main():
56+
item = MDIMPORT[sys.argv[1]]
5657

57-
metad = None
58+
metad = None
5859

59-
if item["type"] == "local":
60-
metad = MetaDataFile(sys.argv[1], ONTS.values(), item["file"])
61-
elif item["type"] == "external":
62-
metad = MetaDataExtern(sys.argv[1], ONTS.values(),
63-
item["url"], "/opt/local/bin/xmlsec1", item["cert"])
60+
if item["type"] == "local":
61+
metad = MetaDataFile(sys.argv[1], ONTS.values(), item["file"])
62+
elif item["type"] == "external":
63+
metad = MetaDataExtern(sys.argv[1], ONTS.values(),
64+
item["url"], "/opt/local/bin/xmlsec1", item["cert"])
6465

65-
if metad:
66-
metad.load()
67-
print metad.dumps()
66+
if metad:
67+
metad.load()
68+
print metad.dumps()
6869

70+
71+
if __name__ == '__main__':
72+
main()

0 commit comments

Comments
 (0)