Updated tests
This commit is contained in:
15
tests/edugain.pem
Normal file
15
tests/edugain.pem
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIICVzCCAcACCQDnwXdaJ4G3vTANBgkqhkiG9w0BAQUFADBwMQswCQYDVQQGEwJO
|
||||||
|
TzESMBAGA1UECBMJVHJvbmRoZWltMRIwEAYDVQQHEwlUcm9uZGhlaW0xDjAMBgNV
|
||||||
|
BAoTBUZlaWRlMQ4wDAYDVQQLEwVGZWlkZTEZMBcGA1UEAxMQZWR1Z2Fpbi5mZWlk
|
||||||
|
ZS5ubzAeFw0wOTA4MzEwNjU2NDJaFw0zNzAxMTUwNjU2NDJaMHAxCzAJBgNVBAYT
|
||||||
|
Ak5PMRIwEAYDVQQIEwlUcm9uZGhlaW0xEjAQBgNVBAcTCVRyb25kaGVpbTEOMAwG
|
||||||
|
A1UEChMFRmVpZGUxDjAMBgNVBAsTBUZlaWRlMRkwFwYDVQQDExBlZHVnYWluLmZl
|
||||||
|
aWRlLm5vMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC0/w1x1eIAbLYSVqCc
|
||||||
|
OWiPC3lhWRNEBgRXFdCo/CFQt1DSAh6AYIw9nGWatqiKD0dtXhn+g4or36fF+l4t
|
||||||
|
FlKwMjIRdB9EM3dp8ErhecauLTAXzJGI16YrfI5932UJr4NDJB/Wm1GKefyu5QIR
|
||||||
|
w9NTEImw8CmUzzzmMd7TBM2epwIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAJpIWdXn
|
||||||
|
FL/j9Cm/Pdn6Yoxkf1mWy8L8WSwF8j9xfkvp53/GMd9IFkgkBbZo+F9CDH2la6H3
|
||||||
|
vseA3ZJrXrxSn5RBhI5XJ85DGfdcMYJy3K42Y6mAUghVv1n+rf39w/cyuSRIW0IY
|
||||||
|
XE3ANufnryezpDUffXpzdUltuTCpu2qfKEj2
|
||||||
|
-----END CERTIFICATE-----
|
||||||
37
tests/test_config.py
Normal file
37
tests/test_config.py
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
|
||||||
|
from saml2.config import Config
|
||||||
|
|
||||||
|
c1 = {
|
||||||
|
"service": ["sp"],
|
||||||
|
"entityid" : "urn:mace:umu.se:saml:roland:sp",
|
||||||
|
# "my_name" : "urn:mace:umu.se:saml:roland:sp",
|
||||||
|
"service_url" : "http://lingon.catalogix.se:8087/",
|
||||||
|
# "debug" : 1,
|
||||||
|
"key_file" : "tests/mykey.pem",
|
||||||
|
"cert_file" : "tests/mycert.pem",
|
||||||
|
"xmlsec_binary" : "/opt/local/bin/xmlsec1",
|
||||||
|
"metadata": {
|
||||||
|
"local": ["tests/metadata.xml",
|
||||||
|
"tests/urn-mace-swami.se-swamid-test-1.0-metadata.xml"],
|
||||||
|
# "remote":{
|
||||||
|
# "edugain":{
|
||||||
|
# "url": "https://www.example.com/?id=edugain&set=saml2",
|
||||||
|
# "cert": "./edugain.pem",
|
||||||
|
# }
|
||||||
|
# }
|
||||||
|
},
|
||||||
|
"idp_entity_id": "urn:mace:umu.se:saml:roland:idp",
|
||||||
|
"virtual_organization" : {
|
||||||
|
"http://vo.example.org/biomed":{
|
||||||
|
"nameid_format" : "urn:oid:2.16.756.1.2.5.1.1.1-NameID",
|
||||||
|
"common_identifier": "swissEduPersonUniqueID",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
def test_1():
|
||||||
|
c = Config()
|
||||||
|
c.load(c1)
|
||||||
16
tests/test_external_metadata.py
Normal file
16
tests/test_external_metadata.py
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
|
||||||
|
from saml2 import metadata, utils
|
||||||
|
from saml2 import NAMESPACE as SAML2_NAMESPACE
|
||||||
|
from saml2 import BINDING_SOAP
|
||||||
|
from saml2 import md, saml, samlp
|
||||||
|
from saml2 import time_util
|
||||||
|
from saml2.saml import NAMEID_FORMAT_TRANSIENT
|
||||||
|
|
||||||
|
def test_edugain():
|
||||||
|
md = metadata.MetaData(xmlsec_binary="/opt/local/bin/xmlsec1")
|
||||||
|
md.import_external_metadata(
|
||||||
|
"https://hbe.edugain.bridge.feide.no/simplesaml/module.php/aggregator/?id=edugain&set=saml2",
|
||||||
|
"tests/edugain.pem")
|
||||||
|
|
||||||
|
print md.entity.keys()
|
||||||
|
assert md.entity
|
||||||
17
tests/test_utils.py
Normal file
17
tests/test_utils.py
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from saml2.utils import deflate_and_base64_encode
|
||||||
|
from saml2.utils import decode_base64_and_inflate
|
||||||
|
import zlib
|
||||||
|
import base64
|
||||||
|
import gzip
|
||||||
|
from saml2.sigver import make_temp
|
||||||
|
|
||||||
|
def test_encode_decode():
|
||||||
|
package = "1234567890abcdefghijklmnopqrstuvxyzåäö"
|
||||||
|
|
||||||
|
intermediate = deflate_and_base64_encode(package)
|
||||||
|
res = decode_base64_and_inflate(intermediate)
|
||||||
|
assert package == res
|
||||||
|
|
||||||
Reference in New Issue
Block a user