summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortpazderka <tomas.pazderka@nic.cz>2014-10-01 09:57:12 +0200
committertpazderka <tomas.pazderka@nic.cz>2014-12-10 15:36:25 +0100
commiteaac71d3f288a4ef9baa3916a04ec735d29cebcc (patch)
tree1116f334746783c75ffe18e7075de100a5d33f4d
parent053dce72d9d088e701a3249a4629deb1b976f14e (diff)
downloadpysaml2-eaac71d3f288a4ef9baa3916a04ec735d29cebcc.tar.gz
Updated tests to pass with the redesigned MetaData import
-rw-r--r--tests/disco_conf.py7
-rw-r--r--tests/idp_all_conf.py9
-rw-r--r--tests/idp_conf.py9
-rw-r--r--tests/idp_conf_ec.py9
-rw-r--r--tests/idp_conf_mdb.py9
-rw-r--r--tests/idp_slo_redirect_conf.py7
-rw-r--r--tests/idp_soap_conf.py7
-rw-r--r--tests/idp_sp_conf.py7
-rw-r--r--tests/restrictive_idp_conf.py7
-rw-r--r--tests/server_conf.py7
-rw-r--r--tests/server_conf_syslog.py7
-rw-r--r--tests/servera_conf.py7
-rw-r--r--tests/sp_1_conf.py7
-rw-r--r--tests/sp_slo_redirect_conf.py7
-rw-r--r--tests/test_30_mdstore.py70
-rw-r--r--tests/test_31_config.py9
-rw-r--r--tests/test_37_entity_categories.py8
-rw-r--r--tests/test_76_metadata_in_mdb.py2
18 files changed, 110 insertions, 85 deletions
diff --git a/tests/disco_conf.py b/tests/disco_conf.py
index 253dc22e..68cf0388 100644
--- a/tests/disco_conf.py
+++ b/tests/disco_conf.py
@@ -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"), )],
+ }],
}
diff --git a/tests/idp_all_conf.py b/tests/idp_all_conf.py
index 3ff2fa99..e4b0b7ee 100644
--- a/tests/idp_all_conf.py
+++ b/tests/idp_all_conf.py
@@ -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",
diff --git a/tests/idp_conf.py b/tests/idp_conf.py
index f0d01804..ffac5589 100644
--- a/tests/idp_conf.py
+++ b/tests/idp_conf.py
@@ -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",
diff --git a/tests/idp_conf_ec.py b/tests/idp_conf_ec.py
index 39b343cf..a2a670b2 100644
--- a/tests/idp_conf_ec.py
+++ b/tests/idp_conf_ec.py
@@ -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",
diff --git a/tests/idp_conf_mdb.py b/tests/idp_conf_mdb.py
index f4afe1ca..1b8bc8be 100644
--- a/tests/idp_conf_mdb.py
+++ b/tests/idp_conf_mdb.py
@@ -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",
diff --git a/tests/idp_slo_redirect_conf.py b/tests/idp_slo_redirect_conf.py
index 530f0fe0..8e5c48a8 100644
--- a/tests/idp_slo_redirect_conf.py
+++ b/tests/idp_slo_redirect_conf.py
@@ -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",
diff --git a/tests/idp_soap_conf.py b/tests/idp_soap_conf.py
index 110bccdf..e65c1b81 100644
--- a/tests/idp_soap_conf.py
+++ b/tests/idp_soap_conf.py
@@ -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",
diff --git a/tests/idp_sp_conf.py b/tests/idp_sp_conf.py
index 2f7a7b50..c686cffe 100644
--- a/tests/idp_sp_conf.py
+++ b/tests/idp_sp_conf.py
@@ -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",
diff --git a/tests/restrictive_idp_conf.py b/tests/restrictive_idp_conf.py
index 468c9782..ca089daa 100644
--- a/tests/restrictive_idp_conf.py
+++ b/tests/restrictive_idp_conf.py
@@ -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"),
}
diff --git a/tests/server_conf.py b/tests/server_conf.py
index 2ff8f6dc..bb9de901 100644
--- a/tests/server_conf.py
+++ b/tests/server_conf.py
@@ -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",
diff --git a/tests/server_conf_syslog.py b/tests/server_conf_syslog.py
index 4dc6a85b..ce6d841f 100644
--- a/tests/server_conf_syslog.py
+++ b/tests/server_conf_syslog.py
@@ -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",
diff --git a/tests/servera_conf.py b/tests/servera_conf.py
index 8d1c58c0..3ab8741b 100644
--- a/tests/servera_conf.py
+++ b/tests/servera_conf.py
@@ -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",
diff --git a/tests/sp_1_conf.py b/tests/sp_1_conf.py
index 90bf0752..834ff15a 100644
--- a/tests/sp_1_conf.py
+++ b/tests/sp_1_conf.py
@@ -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",
diff --git a/tests/sp_slo_redirect_conf.py b/tests/sp_slo_redirect_conf.py
index 104d2f74..7bc17a1b 100644
--- a/tests/sp_slo_redirect_conf.py
+++ b/tests/sp_slo_redirect_conf.py
@@ -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",
diff --git a/tests/test_30_mdstore.py b/tests/test_30_mdstore.py
index 76a4a6ba..8e02f288 100644
--- a/tests/test_30_mdstore.py
+++ b/tests/test_30_mdstore.py
@@ -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,
diff --git a/tests/test_31_config.py b/tests/test_31_config.py
index 245714b3..ea25abbb 100644
--- a/tests/test_31_config.py
+++ b/tests/test_31_config.py
@@ -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",
diff --git a/tests/test_37_entity_categories.py b/tests/test_37_entity_categories.py
index 63fdefa4..3e95458f 100644
--- a/tests/test_37_entity_categories.py
+++ b/tests/test_37_entity_categories.py
@@ -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"],
diff --git a/tests/test_76_metadata_in_mdb.py b/tests/test_76_metadata_in_mdb.py
index e6b6f0b1..6520ec1e 100644
--- a/tests/test_76_metadata_in_mdb.py
+++ b/tests/test_76_metadata_in_mdb.py
@@ -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: