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