Updated tests to pass with the redesigned MetaData import
This commit is contained in:
@@ -19,7 +19,8 @@ CONFIG = {
|
||||
},
|
||||
"debug": 1,
|
||||
"xmlsec_binary": xmlsec_path,
|
||||
"metadata": {
|
||||
"local": [full_path("servera.xml")],
|
||||
},
|
||||
"metadata": [{
|
||||
"class": "saml2.mdstore.MetaDataFile",
|
||||
"metadata": [(full_path("servera.xml"), )],
|
||||
}],
|
||||
}
|
||||
|
@@ -87,10 +87,11 @@ CONFIG = {
|
||||
"key_file": full_path("test.key"),
|
||||
"cert_file": full_path("test.pem"),
|
||||
"xmlsec_path": ["/usr/local/bin", "/opt/local/bin"],
|
||||
"metadata": {
|
||||
"local": [full_path("servera.xml"),
|
||||
full_path("vo_metadata.xml")],
|
||||
},
|
||||
"metadata": [{
|
||||
"class": "saml2.mdstore.MetaDataFile",
|
||||
"metadata": [(full_path("servera.xml"), ),
|
||||
(full_path("vo_metadata.xml"), )],
|
||||
}],
|
||||
"attribute_map_dir": full_path("attributemaps"),
|
||||
"organization": {
|
||||
"name": "Exempel AB",
|
||||
|
@@ -45,10 +45,11 @@ CONFIG = {
|
||||
"key_file": full_path("test.key"),
|
||||
"cert_file": full_path("test.pem"),
|
||||
"xmlsec_binary": xmlsec_path,
|
||||
"metadata": {
|
||||
"local": [full_path("metadata_sp_1.xml"),
|
||||
full_path("vo_metadata.xml")],
|
||||
},
|
||||
"metadata": [{
|
||||
"class": "saml2.mdstore.MetaDataFile",
|
||||
"metadata": [(full_path("metadata_sp_1.xml"), ),
|
||||
(full_path("vo_metadata.xml"), )],
|
||||
}],
|
||||
"attribute_map_dir": full_path("attributemaps"),
|
||||
"organization": {
|
||||
"name": "Exempel AB",
|
||||
|
@@ -38,10 +38,11 @@ CONFIG = {
|
||||
"key_file": full_path("test.key"),
|
||||
"cert_file": full_path("test.pem"),
|
||||
"xmlsec_binary": xmlsec_path,
|
||||
"metadata": {
|
||||
"local": [full_path("metadata_sp_1.xml"),
|
||||
full_path("vo_metadata.xml")],
|
||||
},
|
||||
"metadata": [{
|
||||
"class": "saml2.mdstore.MetaDataFile",
|
||||
"metadata": [(full_path("metadata_sp_1.xml"), ),
|
||||
(full_path("vo_metadata.xml"), )],
|
||||
}],
|
||||
"attribute_map_dir": full_path("attributemaps"),
|
||||
"organization": {
|
||||
"name": "Exempel AB",
|
||||
|
@@ -88,10 +88,11 @@ CONFIG = {
|
||||
"cert_file": full_path("test.pem"),
|
||||
#"xmlsec_binary": None,
|
||||
"xmlsec_path": ["/opt/local/bin", "usr/local/bin"],
|
||||
"metadata": {
|
||||
"local": [full_path("servera.xml"),
|
||||
full_path("vo_metadata.xml")],
|
||||
},
|
||||
"metadata": [{
|
||||
"class": "saml2.mdstore.MetaDataFile",
|
||||
"metadata": [(full_path("servera.xml"), ),
|
||||
(full_path("vo_metadata.xml"), )],
|
||||
}],
|
||||
"attribute_map_dir": full_path("attributemaps"),
|
||||
"organization": {
|
||||
"name": "Exempel AB",
|
||||
|
@@ -33,9 +33,10 @@ CONFIG = {
|
||||
"key_file" : full_path("test.key"),
|
||||
"cert_file" : full_path("test.pem"),
|
||||
"xmlsec_binary" : None,
|
||||
"metadata": {
|
||||
"local": [full_path("sp_slo_redirect.xml")],
|
||||
},
|
||||
"metadata": [{
|
||||
"class": "saml2.mdstore.MetaDataFile",
|
||||
"metadata": [(full_path("sp_slo_redirect.xml"), )],
|
||||
}],
|
||||
"attribute_map_dir" : full_path("attributemaps"),
|
||||
"organization": {
|
||||
"name": "Exempel AB",
|
||||
|
@@ -37,9 +37,10 @@ CONFIG={
|
||||
"key_file" : full_path("test.key"),
|
||||
"cert_file" : full_path("test.pem"),
|
||||
#"xmlsec_binary" : None,
|
||||
"metadata": {
|
||||
"local": [full_path("metadata.xml"), full_path("vo_metadata.xml")],
|
||||
},
|
||||
"metadata": [{
|
||||
"class": "saml2.mdstore.MetaDataFile",
|
||||
"metadata": [(full_path("metadata.xml"), ), (full_path("vo_metadata.xml"), )],
|
||||
}],
|
||||
"attribute_map_dir" : full_path("attributemaps"),
|
||||
"organization": {
|
||||
"name": "Exempel AB",
|
||||
|
@@ -50,9 +50,10 @@ CONFIG = {
|
||||
"key_file" : full_path("test.key"),
|
||||
"cert_file" : full_path("test.pem"),
|
||||
"xmlsec_binary" : None,
|
||||
"metadata": {
|
||||
"local": [full_path("metadata.xml"), full_path("vo_metadata.xml")],
|
||||
},
|
||||
"metadata": [{
|
||||
"class": "saml2.mdstore.MetaDataFile",
|
||||
"metadata": [(full_path("metadata.xml"), ), (full_path("vo_metadata.xml"), )],
|
||||
}],
|
||||
"attribute_map_dir" : full_path("attributemaps"),
|
||||
"organization": {
|
||||
"name": "Exempel AB",
|
||||
|
@@ -37,8 +37,9 @@ CONFIG = {
|
||||
"key_file" : full_path("test.key"),
|
||||
"cert_file" : full_path("test.pem"),
|
||||
"xmlsec_binary" : None,
|
||||
"metadata": {
|
||||
"local": [full_path("sp_0.metadata")],
|
||||
},
|
||||
"metadata": [{
|
||||
"class": "saml2.mdstore.MetaDataFile",
|
||||
"metadata": [(full_path("sp_0.metadata"), )],
|
||||
}],
|
||||
"attribute_map_dir" : full_path("attributemaps"),
|
||||
}
|
||||
|
@@ -21,9 +21,10 @@ CONFIG = {
|
||||
"cert_file": full_path("test.pem"),
|
||||
"ca_certs": full_path("cacerts.txt"),
|
||||
"xmlsec_binary": xmlsec_path,
|
||||
"metadata": {
|
||||
"local": [full_path("idp.xml"), full_path("vo_metadata.xml")],
|
||||
},
|
||||
"metadata": [{
|
||||
"class": "saml2.mdstore.MetaDataFile",
|
||||
"metadata": [(full_path("idp.xml"), ), (full_path("vo_metadata.xml"), )],
|
||||
}],
|
||||
"virtual_organization": {
|
||||
"urn:mace:example.com:it:tek": {
|
||||
"nameid_format": "urn:oid:1.3.6.1.4.1.1466.115.121.1.15-NameID",
|
||||
|
@@ -22,9 +22,10 @@ CONFIG = {
|
||||
"key_file": full_path("test.key"),
|
||||
"cert_file": full_path("test.pem"),
|
||||
# "xmlsec_binary" : None,
|
||||
"metadata": {
|
||||
"local": [full_path("idp.xml"), full_path("vo_metadata.xml")],
|
||||
},
|
||||
"metadata": [{
|
||||
"class": "saml2.mdstore.MetaDataFile",
|
||||
"metadata": [(full_path("idp.xml"), ), (full_path("vo_metadata.xml"), )],
|
||||
}],
|
||||
"virtual_organization": {
|
||||
"urn:mace:example.com:it:tek": {
|
||||
"nameid_format": "urn:oid:1.3.6.1.4.1.1466.115.121.1.15-NameID",
|
||||
|
@@ -51,9 +51,10 @@ CONFIG = {
|
||||
"cert_file": full_path("test.pem"),
|
||||
"ca_certs": full_path("cacerts.txt"),
|
||||
"xmlsec_binary": xmlsec_path,
|
||||
"metadata": {
|
||||
"local": [full_path("idp_all.xml"), full_path("vo_metadata.xml")],
|
||||
},
|
||||
"metadata": [{
|
||||
"class": "saml2.mdstore.MetaDataFile",
|
||||
"metadata": [(full_path("idp_all.xml"), ), (full_path("vo_metadata.xml"), )],
|
||||
}],
|
||||
"virtual_organization": {
|
||||
"urn:mace:example.com:it:tek": {
|
||||
"nameid_format": "urn:oid:1.3.6.1.4.1.1466.115.121.1.15-NameID",
|
||||
|
@@ -20,9 +20,10 @@ CONFIG = {
|
||||
"key_file": full_path("test.key"),
|
||||
"cert_file": full_path("test.pem"),
|
||||
"xmlsec_binary": None,
|
||||
"metadata": {
|
||||
"local": [full_path("idp.xml"), full_path("vo_metadata.xml")],
|
||||
},
|
||||
"metadata": [{
|
||||
"class": "saml2.mdstore.MetaDataFile",
|
||||
"metadata": [(full_path("idp.xml"), ), (full_path("vo_metadata.xml"), )],
|
||||
}],
|
||||
"virtual_organization": {
|
||||
"urn:mace:example.com:it:tek": {
|
||||
"nameid_format": "urn:oid:1.3.6.1.4.1.1466.115.121.1.15-NameID",
|
||||
|
@@ -27,9 +27,10 @@ CONFIG = {
|
||||
"key_file": full_path("test.key"),
|
||||
"cert_file": full_path("test.pem"),
|
||||
"xmlsec_binary": None,
|
||||
"metadata": {
|
||||
"local": [full_path("idp_slo_redirect.xml")],
|
||||
},
|
||||
"metadata": [{
|
||||
"class": "saml2.mdstore.MetaDataFile",
|
||||
"metadata": [(full_path("idp_slo_redirect.xml"), )],
|
||||
}],
|
||||
"virtual_organization": {
|
||||
"urn:mace:example.com:it:tek": {
|
||||
"nameid_format": "urn:oid:1.3.6.1.4.1.1466.115.121.1.15-NameID",
|
||||
|
@@ -49,34 +49,44 @@ ONTS = {
|
||||
ATTRCONV = ac_factory(full_path("attributemaps"))
|
||||
|
||||
METADATACONF = {
|
||||
"1": {
|
||||
"local": [full_path("swamid-1.0.xml")]
|
||||
},
|
||||
"2": {
|
||||
"local": [full_path("InCommon-metadata.xml")]
|
||||
},
|
||||
"3": {
|
||||
"local": [full_path("extended.xml")]
|
||||
},
|
||||
"7": {
|
||||
"local": [full_path("metadata_sp_1.xml"),
|
||||
full_path("InCommon-metadata.xml")],
|
||||
"remote": [
|
||||
{"url": "https://kalmar2.org/simplesaml/module.php/aggregator/?id=kalmarcentral2&set=saml2",
|
||||
"cert": full_path("kalmar2.pem")}]
|
||||
},
|
||||
"4": {
|
||||
"local": [full_path("metadata_example.xml")]
|
||||
},
|
||||
"5": {
|
||||
"local": [full_path("metadata.aaitest.xml")]
|
||||
},
|
||||
"8": {
|
||||
"mdfile": [full_path("swamid.md")]
|
||||
},
|
||||
"9": {
|
||||
"local": [full_path("metadata")]
|
||||
}
|
||||
"1": [{
|
||||
"class": "saml2.mdstore.MetaDataFile",
|
||||
"metadata": [(full_path("swamid-1.0.xml"), )],
|
||||
}],
|
||||
"2": [{
|
||||
"class": "saml2.mdstore.MetaDataFile",
|
||||
"metadata": [(full_path("InCommon-metadata.xml"), )],
|
||||
}],
|
||||
"3": [{
|
||||
"class": "saml2.mdstore.MetaDataFile",
|
||||
"metadata": [(full_path("extended.xml"), )],
|
||||
}],
|
||||
"7": [{
|
||||
"class": "saml2.mdstore.MetaDataFile",
|
||||
"metadata": [(full_path("metadata_sp_1.xml"), ),
|
||||
(full_path("InCommon-metadata.xml"), )], },
|
||||
{
|
||||
"class": "saml2.mdstore.MetaDataExtern",
|
||||
"metadata": [
|
||||
("https://kalmar2.org/simplesaml/module.php/aggregator/?id=kalmarcentral2&set=saml2",
|
||||
full_path("kalmar2.pem")), ],
|
||||
}],
|
||||
"4": [{
|
||||
"class": "saml2.mdstore.MetaDataFile",
|
||||
"metadata": [(full_path("metadata_example.xml"), )],
|
||||
}],
|
||||
"5": [{
|
||||
"class": "saml2.mdstore.MetaDataFile",
|
||||
"metadata": [(full_path("metadata.aaitest.xml"), )],
|
||||
}],
|
||||
"8": [{
|
||||
"class": "saml2.mdstore.MetaDataMD",
|
||||
"metadata": [(full_path("swamid.md"), )],
|
||||
}],
|
||||
"9": [{
|
||||
"class": "saml2.mdstore.MetaDataFile",
|
||||
"metadata": [(full_path("metadata"), )]
|
||||
}]
|
||||
}
|
||||
|
||||
|
||||
@@ -117,13 +127,13 @@ def test_swami_1():
|
||||
lnamn = [d_to_local_name(mds.attrc, attr) for attr in wants["optional"]]
|
||||
assert _eq(lnamn, ['eduPersonPrincipalName', 'mail', 'givenName', 'sn',
|
||||
'eduPersonScopedAffiliation'])
|
||||
|
||||
|
||||
wants = mds.attribute_requirement('https://beta.lobber.se/shibboleth')
|
||||
assert wants["required"] == []
|
||||
lnamn = [d_to_local_name(mds.attrc, attr) for attr in wants["optional"]]
|
||||
assert _eq(lnamn, ['eduPersonPrincipalName', 'mail', 'givenName', 'sn',
|
||||
'eduPersonScopedAffiliation', 'eduPersonEntitlement'])
|
||||
|
||||
|
||||
|
||||
def test_incommon_1():
|
||||
mds = MetadataStore(ONTS.values(), ATTRCONV, sec_config,
|
||||
|
@@ -32,10 +32,11 @@ sp1 = {
|
||||
},
|
||||
"key_file": full_path("test.key"),
|
||||
"cert_file": full_path("test.pem"),
|
||||
"metadata": {
|
||||
"local": [full_path("metadata.xml"),
|
||||
full_path("urn-mace-swami.se-swamid-test-1.0-metadata.xml")],
|
||||
},
|
||||
"metadata": [{
|
||||
"class": "saml2.mdstore.MetaDataFile",
|
||||
"metadata": [(full_path("metadata.xml"), ),
|
||||
(full_path("urn-mace-swami.se-swamid-test-1.0-metadata.xml"), )],
|
||||
}],
|
||||
"virtual_organization": {
|
||||
"coip": {
|
||||
"nameid_format": "urn:oasis:names:tc:SAML:2.0:nameid-format:transient",
|
||||
|
@@ -35,7 +35,7 @@ __author__ = 'rolandh'
|
||||
|
||||
MDS = MetadataStore(ONTS.values(), ATTRCONV, sec_config,
|
||||
disable_ssl_certificate_validation=True)
|
||||
MDS.imp({"mdfile": [full_path("swamid.md")]})
|
||||
MDS.imp([{"class": "saml2.mdstore.MetaDataMD", "metadata": [(full_path("swamid.md"), )]}])
|
||||
|
||||
|
||||
def _eq(l1, l2):
|
||||
@@ -91,7 +91,7 @@ def test_filter_ava3():
|
||||
|
||||
mds = MetadataStore(ONTS.values(), ATTRCONV, sec_config,
|
||||
disable_ssl_certificate_validation=True)
|
||||
mds.imp({"local": [full_path("entity_cat_sfs_hei.xml")]})
|
||||
mds.imp([{"class": "saml2.mdstore.MetaDataFile", "metadata": [(full_path("entity_cat_sfs_hei.xml"), )]}])
|
||||
|
||||
ava = {"givenName": ["Derek"], "sn": ["Jeter"],
|
||||
"mail": ["derek@nyy.mlb.com"], "c": ["USA"],
|
||||
@@ -114,7 +114,7 @@ def test_filter_ava4():
|
||||
|
||||
mds = MetadataStore(ONTS.values(), ATTRCONV, sec_config,
|
||||
disable_ssl_certificate_validation=True)
|
||||
mds.imp({"local": [full_path("entity_cat_re_nren.xml")]})
|
||||
mds.imp([{"class": "saml2.mdstore.MetaDataFile", "metadata": [(full_path("entity_cat_re_nren.xml"), )]}])
|
||||
|
||||
ava = {"givenName": ["Derek"], "sn": ["Jeter"],
|
||||
"mail": ["derek@nyy.mlb.com"], "c": ["USA"],
|
||||
@@ -138,7 +138,7 @@ def test_filter_ava5():
|
||||
|
||||
mds = MetadataStore(ONTS.values(), ATTRCONV, sec_config,
|
||||
disable_ssl_certificate_validation=True)
|
||||
mds.imp({"local": [full_path("entity_cat_re.xml")]})
|
||||
mds.imp([{"class": "saml2.mdstore.MetaDataFile", "metadata": [(full_path("entity_cat_re.xml"), )]}])
|
||||
|
||||
ava = {"givenName": ["Derek"], "sn": ["Jeter"],
|
||||
"mail": ["derek@nyy.mlb.com"], "c": ["USA"],
|
||||
|
@@ -53,7 +53,7 @@ def test_metadata():
|
||||
disable_ssl_certificate_validation=True)
|
||||
|
||||
# Import metadata from local file.
|
||||
mds.imp({"local": [full_path("swamid-2.0.xml")]})
|
||||
mds.imp([{"class": "saml2.mdstore.MetaDataFile", "metadata": [(full_path("swamid-2.0.xml"), )]}])
|
||||
assert len(mds) == 1 # One source
|
||||
|
||||
try:
|
||||
|
Reference in New Issue
Block a user