Allow running the tests from the pysaml2 root directory.
This improves previous work for running the tests via the command "python setup.py test" from a fresh clone. This can be very useful to integrate pysaml2 in a continuous integration system such as Jenkins or Travis.
This commit is contained in:
parent
ca6afd92fc
commit
2ae12290b0
2105
runtests.py
2105
runtests.py
File diff suppressed because it is too large
Load Diff
23
setup.py
23
setup.py
|
@ -18,20 +18,22 @@
|
|||
#
|
||||
import sys
|
||||
|
||||
from distutils.core import Command
|
||||
from setuptools import setup
|
||||
from setuptools.command.test import test as TestCommand
|
||||
|
||||
|
||||
class PyTest(Command):
|
||||
user_options = []
|
||||
def initialize_options(self):
|
||||
pass
|
||||
class PyTest(TestCommand):
|
||||
|
||||
def finalize_options(self):
|
||||
pass
|
||||
def run(self):
|
||||
import sys, subprocess
|
||||
errno = subprocess.call([sys.executable, 'runtests.py'])
|
||||
raise SystemExit(errno)
|
||||
TestCommand.finalize_options(self)
|
||||
self.test_args = []
|
||||
self.test_suite = True
|
||||
|
||||
def run_tests(self):
|
||||
#import here, cause outside the eggs aren't loaded
|
||||
import pytest
|
||||
errno = pytest.main(self.test_args)
|
||||
sys.exit(errno)
|
||||
|
||||
|
||||
install_requires=[
|
||||
|
@ -86,5 +88,6 @@ setup(
|
|||
'mongodict': ['mongodict']
|
||||
},
|
||||
zip_safe=False,
|
||||
test_suite='tests',
|
||||
cmdclass={'test': PyTest},
|
||||
)
|
||||
|
|
|
@ -2,11 +2,8 @@
|
|||
from saml2 import BINDING_SOAP, BINDING_HTTP_REDIRECT, NAME_FORMAT_URI
|
||||
BASE = "http://localhost:8089/"
|
||||
|
||||
try:
|
||||
from saml2.sigver import get_xmlsec_binary
|
||||
xmlsec_path = get_xmlsec_binary(["/opt/local/bin"])
|
||||
except ImportError:
|
||||
xmlsec_path = '/usr/bin/xmlsec1'
|
||||
from pathutils import full_path, xmlsec_path
|
||||
|
||||
|
||||
CONFIG={
|
||||
"service":{
|
||||
|
@ -22,19 +19,19 @@ CONFIG={
|
|||
"name_form": NAME_FORMAT_URI,
|
||||
},
|
||||
},
|
||||
"subject_data": "aa.db",
|
||||
"subject_data": full_path("aa.db"),
|
||||
}
|
||||
},
|
||||
"entityid" : BASE+ "aa",
|
||||
"name" : "Rolands AA",
|
||||
"debug" : 1,
|
||||
"key_file" : "test.key",
|
||||
"cert_file" : "test.pem",
|
||||
"key_file" : full_path("test.key"),
|
||||
"cert_file" : full_path("test.pem"),
|
||||
#"xmlsec_binary" : xmlsec_path,
|
||||
"metadata": {
|
||||
"local": ["metadata.xml", "vo_metadata.xml"],
|
||||
"local": [full_path("metadata.xml"), full_path("vo_metadata.xml")],
|
||||
},
|
||||
"attribute_map_dir" : "attributemaps",
|
||||
"attribute_map_dir" : full_path("attributemaps"),
|
||||
"organization": {
|
||||
"name": "Exempel AB",
|
||||
"display_name": [("Exempel AB","se"),("Example Co.","en")],
|
||||
|
|
|
@ -1,14 +1,6 @@
|
|||
from saml2.extension.idpdisc import BINDING_DISCO
|
||||
|
||||
try:
|
||||
from saml2.sigver import get_xmlsec_binary
|
||||
except ImportError:
|
||||
get_xmlsec_binary = None
|
||||
|
||||
if get_xmlsec_binary:
|
||||
xmlsec_path = get_xmlsec_binary(["/opt/local/bin"])
|
||||
else:
|
||||
xmlsec_path = '/usr/bin/xmlsec1'
|
||||
from pathutils import full_path, xmlsec_path
|
||||
|
||||
BASE = "http://localhost:8088"
|
||||
|
||||
|
@ -27,6 +19,6 @@ CONFIG = {
|
|||
"debug" : 1,
|
||||
"xmlsec_binary" : xmlsec_path,
|
||||
"metadata": {
|
||||
"local": ["servera.xml"],
|
||||
"local": [full_path("servera.xml")],
|
||||
},
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from saml2 import BINDING_SOAP, BINDING_URI
|
||||
from saml2 import BINDING_HTTP_REDIRECT
|
||||
from saml2 import BINDING_HTTP_POST
|
||||
|
@ -8,15 +7,7 @@ from saml2 import BINDING_HTTP_ARTIFACT
|
|||
from saml2.saml import NAMEID_FORMAT_PERSISTENT
|
||||
from saml2.saml import NAME_FORMAT_URI
|
||||
|
||||
try:
|
||||
from saml2.sigver import get_xmlsec_binary
|
||||
except ImportError:
|
||||
get_xmlsec_binary = None
|
||||
|
||||
if get_xmlsec_binary:
|
||||
xmlsec_path = get_xmlsec_binary(["/opt/local/bin"])
|
||||
else:
|
||||
xmlsec_path = '/usr/bin/xmlsec1'
|
||||
from pathutils import full_path, xmlsec_path
|
||||
|
||||
BASE = "http://localhost:8088"
|
||||
|
||||
|
@ -92,13 +83,14 @@ CONFIG = {
|
|||
},
|
||||
},
|
||||
"debug" : 1,
|
||||
"key_file" : "test.key",
|
||||
"cert_file" : "test.pem",
|
||||
"key_file" : full_path("test.key"),
|
||||
"cert_file" : full_path("test.pem"),
|
||||
"xmlsec_binary" : xmlsec_path,
|
||||
"metadata": {
|
||||
"local": ["servera.xml", "vo_metadata.xml"],
|
||||
"local": [full_path("servera.xml"),
|
||||
full_path("vo_metadata.xml")],
|
||||
},
|
||||
"attribute_map_dir" : "attributemaps",
|
||||
"attribute_map_dir" : full_path("attributemaps"),
|
||||
"organization": {
|
||||
"name": "Exempel AB",
|
||||
"display_name": [("Exempel ÄB","se"),("Example Co.","en")],
|
||||
|
|
|
@ -2,11 +2,7 @@ from saml2 import BINDING_SOAP, BINDING_HTTP_REDIRECT, BINDING_HTTP_POST
|
|||
from saml2.saml import NAMEID_FORMAT_PERSISTENT
|
||||
from saml2.saml import NAME_FORMAT_URI
|
||||
|
||||
try:
|
||||
from saml2.sigver import get_xmlsec_binary
|
||||
xmlsec_path = get_xmlsec_binary(["/opt/local/bin"])
|
||||
except ImportError:
|
||||
xmlsec_path = '/usr/bin/xmlsec1'
|
||||
from pathutils import full_path, xmlsec_path
|
||||
|
||||
BASE = "http://localhost:8088"
|
||||
|
||||
|
@ -37,19 +33,20 @@ CONFIG = {
|
|||
# }
|
||||
}
|
||||
},
|
||||
"subject_data": "subject_data.db",
|
||||
"subject_data": full_path("subject_data.db"),
|
||||
#"domain": "umu.se",
|
||||
#"name_qualifier": ""
|
||||
},
|
||||
},
|
||||
"debug" : 1,
|
||||
"key_file" : "test.key",
|
||||
"cert_file" : "test.pem",
|
||||
"key_file" : full_path("test.key"),
|
||||
"cert_file" : full_path("test.pem"),
|
||||
"xmlsec_binary" : xmlsec_path,
|
||||
"metadata": {
|
||||
"local": ["metadata_sp_1.xml", "vo_metadata.xml"],
|
||||
"local": [full_path("metadata_sp_1.xml"),
|
||||
full_path("vo_metadata.xml")],
|
||||
},
|
||||
"attribute_map_dir" : "attributemaps",
|
||||
"attribute_map_dir" : full_path("attributemaps"),
|
||||
"organization": {
|
||||
"name": "Exempel AB",
|
||||
"display_name": [("Exempel AB","se"),("Example Co.","en")],
|
||||
|
|
|
@ -2,11 +2,7 @@ from saml2 import BINDING_HTTP_REDIRECT
|
|||
from saml2.saml import NAMEID_FORMAT_PERSISTENT
|
||||
from saml2.saml import NAME_FORMAT_URI
|
||||
|
||||
try:
|
||||
from saml2.sigver import get_xmlsec_binary
|
||||
xmlsec_path = get_xmlsec_binary(["/opt/local/bin"])
|
||||
except ImportError:
|
||||
xmlsec_path = '/usr/bin/xmlsec1'
|
||||
from pathutils import full_path, xmlsec_path
|
||||
|
||||
CONFIG = {
|
||||
"entityid" : "urn:mace:example.com:saml:roland:idp",
|
||||
|
@ -30,17 +26,17 @@ CONFIG = {
|
|||
"nameid_format": NAMEID_FORMAT_PERSISTENT,
|
||||
}
|
||||
},
|
||||
"subject_data": "subject_data.db",
|
||||
"subject_data": full_path("subject_data.db"),
|
||||
}
|
||||
},
|
||||
"debug" : 1,
|
||||
"key_file" : "test.key",
|
||||
"cert_file" : "test.pem",
|
||||
"key_file" : full_path("test.key"),
|
||||
"cert_file" : full_path("test.pem"),
|
||||
"xmlsec_binary" : xmlsec_path,
|
||||
"metadata": {
|
||||
"local": ["sp_slo_redirect.xml"],
|
||||
"local": [full_path("sp_slo_redirect.xml")],
|
||||
},
|
||||
"attribute_map_dir" : "attributemaps",
|
||||
"attribute_map_dir" : full_path("attributemaps"),
|
||||
"organization": {
|
||||
"name": "Exempel AB",
|
||||
"display_name": [("Exempel AB","se"),("Example Co.","en")],
|
||||
|
|
|
@ -2,11 +2,7 @@ from saml2 import BINDING_SOAP, BINDING_HTTP_REDIRECT
|
|||
from saml2.saml import NAMEID_FORMAT_PERSISTENT
|
||||
from saml2.saml import NAME_FORMAT_URI
|
||||
|
||||
try:
|
||||
from saml2.sigver import get_xmlsec_binary
|
||||
xmlsec_path = get_xmlsec_binary(["/opt/local/bin"])
|
||||
except ImportError:
|
||||
xmlsec_path = '/usr/bin/xmlsec1'
|
||||
from pathutils import full_path
|
||||
|
||||
CONFIG={
|
||||
"entityid" : "urn:mace:example.com:saml:roland:idp",
|
||||
|
@ -34,17 +30,17 @@ CONFIG={
|
|||
# }
|
||||
}
|
||||
},
|
||||
"subject_data": "subject_data.db",
|
||||
"subject_data": full_path("subject_data.db"),
|
||||
}
|
||||
},
|
||||
"debug" : 1,
|
||||
"key_file" : "test.key",
|
||||
"cert_file" : "test.pem",
|
||||
"key_file" : full_path("test.key"),
|
||||
"cert_file" : full_path("test.pem"),
|
||||
#"xmlsec_binary" : xmlsec_path,
|
||||
"metadata": {
|
||||
"local": ["metadata.xml", "vo_metadata.xml"],
|
||||
"local": [full_path("metadata.xml"), full_path("vo_metadata.xml")],
|
||||
},
|
||||
"attribute_map_dir" : "attributemaps",
|
||||
"attribute_map_dir" : full_path("attributemaps"),
|
||||
"organization": {
|
||||
"name": "Exempel AB",
|
||||
"display_name": [("Exempel AB","se"),("Example Co.","en")],
|
||||
|
|
|
@ -6,11 +6,7 @@ from saml2.saml import NAME_FORMAT_URI
|
|||
|
||||
BASE = "http://localhost:8088/"
|
||||
|
||||
try:
|
||||
from saml2.sigver import get_xmlsec_binary
|
||||
xmlsec_path = get_xmlsec_binary(["/opt/local/bin"])
|
||||
except ImportError:
|
||||
xmlsec_path = '/usr/bin/xmlsec1'
|
||||
from pathutils import full_path, xmlsec_path
|
||||
|
||||
CONFIG = {
|
||||
"entityid" : "urn:mace:example.com:saml:roland:idp",
|
||||
|
@ -39,7 +35,7 @@ CONFIG = {
|
|||
# }
|
||||
}
|
||||
},
|
||||
"subject_data": "subject_data.db",
|
||||
"subject_data": full_path("subject_data.db"),
|
||||
},
|
||||
"sp": {
|
||||
"endpoints":{
|
||||
|
@ -51,13 +47,13 @@ CONFIG = {
|
|||
}
|
||||
},
|
||||
"debug" : 1,
|
||||
"key_file" : "test.key",
|
||||
"cert_file" : "test.pem",
|
||||
"key_file" : full_path("test.key"),
|
||||
"cert_file" : full_path("test.pem"),
|
||||
"xmlsec_binary" : xmlsec_path,
|
||||
"metadata": {
|
||||
"local": ["metadata.xml", "vo_metadata.xml"],
|
||||
"local": [full_path("metadata.xml"), full_path("vo_metadata.xml")],
|
||||
},
|
||||
"attribute_map_dir" : "attributemaps",
|
||||
"attribute_map_dir" : full_path("attributemaps"),
|
||||
"organization": {
|
||||
"name": "Exempel AB",
|
||||
"display_name": [("Exempel AB","se"),("Example Co.","en")],
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
import os.path
|
||||
|
||||
BASEDIR = os.path.abspath(os.path.dirname(__file__))
|
||||
|
||||
|
||||
def full_path(local_file):
|
||||
return os.path.join(BASEDIR, local_file)
|
||||
|
||||
|
||||
try:
|
||||
from saml2.sigver import get_xmlsec_binary
|
||||
except ImportError:
|
||||
get_xmlsec_binary = None
|
||||
|
||||
|
||||
if get_xmlsec_binary:
|
||||
xmlsec_path = get_xmlsec_binary(["/opt/local/bin"])
|
||||
else:
|
||||
xmlsec_path = '/usr/bin/xmlsec1'
|
|
@ -3,11 +3,7 @@ from saml2.saml import NAME_FORMAT_URI
|
|||
|
||||
BASE = "http://localhost:8089/"
|
||||
|
||||
try:
|
||||
from saml2.sigver import get_xmlsec_binary
|
||||
xmlsec_path = get_xmlsec_binary(["/opt/local/bin"])
|
||||
except ImportError:
|
||||
xmlsec_path = '/usr/bin/xmlsec1'
|
||||
from pathutils import full_path, xmlsec_path
|
||||
|
||||
CONFIG = {
|
||||
"entityid" : "urn:mace:example.com:saml:roland:idpr",
|
||||
|
@ -35,14 +31,14 @@ CONFIG = {
|
|||
}
|
||||
}
|
||||
},
|
||||
"subject_data": "subject_data.db",
|
||||
"subject_data": full_path("subject_data.db"),
|
||||
}
|
||||
},
|
||||
"key_file" : "test.key",
|
||||
"cert_file" : "test.pem",
|
||||
"key_file" : full_path("test.key"),
|
||||
"cert_file" : full_path("test.pem"),
|
||||
"xmlsec_binary" : xmlsec_path,
|
||||
"metadata": {
|
||||
"local": ["sp_0.metadata"],
|
||||
"local": [full_path("sp_0.metadata")],
|
||||
},
|
||||
"attribute_map_dir" : "attributemaps",
|
||||
"attribute_map_dir" : full_path("attributemaps"),
|
||||
}
|
||||
|
|
|
@ -1,9 +1,4 @@
|
|||
try:
|
||||
from saml2.sigver import get_xmlsec_binary
|
||||
xmlsec_path = get_xmlsec_binary(["/opt/local/bin"])
|
||||
except ImportError:
|
||||
xmlsec_path = '/usr/bin/xmlsec1'
|
||||
|
||||
from pathutils import full_path, xmlsec_path
|
||||
|
||||
CONFIG = {
|
||||
"entityid" : "urn:mace:example.com:saml:roland:sp",
|
||||
|
@ -21,11 +16,11 @@ CONFIG = {
|
|||
}
|
||||
},
|
||||
"debug" : 1,
|
||||
"key_file" : "test.key",
|
||||
"cert_file" : "test.pem",
|
||||
"key_file" : full_path("test.key"),
|
||||
"cert_file" : full_path("test.pem"),
|
||||
"xmlsec_binary" : xmlsec_path,
|
||||
"metadata": {
|
||||
"local": ["idp_soap.xml", "vo_metadata.xml"],
|
||||
"local": [full_path("idp_soap.xml"), full_path("vo_metadata.xml")],
|
||||
},
|
||||
"virtual_organization" : {
|
||||
"urn:mace:example.com:it:tek":{
|
||||
|
@ -34,7 +29,7 @@ CONFIG = {
|
|||
}
|
||||
},
|
||||
"accepted_time_diff": 60,
|
||||
"attribute_map_dir" : "attributemaps",
|
||||
"attribute_map_dir" : full_path("attributemaps"),
|
||||
"organization": {
|
||||
"name": ("AB Exempel", "se"),
|
||||
"display_name": ("AB Exempel", "se"),
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
try:
|
||||
from saml2.sigver import get_xmlsec_binary
|
||||
xmlsec_path = get_xmlsec_binary(["/opt/local/bin"])
|
||||
except ImportError:
|
||||
xmlsec_path = '/usr/bin/xmlsec1'
|
||||
from pathutils import full_path, xmlsec_path
|
||||
|
||||
CONFIG = {
|
||||
"entityid" : "urn:mace:example.com:saml:roland:sp",
|
||||
|
@ -16,15 +12,15 @@ CONFIG = {
|
|||
"required_attributes": ["surName", "givenName", "mail"],
|
||||
"optional_attributes": ["title"],
|
||||
"idp":["urn:mace:example.com:saml:roland:idp"],
|
||||
"subject_data": "subject_data.db",
|
||||
"subject_data": full_path("subject_data.db"),
|
||||
}
|
||||
},
|
||||
"debug" : 1,
|
||||
"key_file" : "test.key",
|
||||
"cert_file" : "test.pem",
|
||||
"key_file" : full_path("test.key"),
|
||||
"cert_file" : full_path("test.pem"),
|
||||
"xmlsec_binary" : xmlsec_path,
|
||||
"metadata": {
|
||||
"local": ["idp_aa.xml", "vo_metadata.xml"],
|
||||
"local": [full_path("idp_aa.xml"), full_path("vo_metadata.xml")],
|
||||
},
|
||||
"virtual_organization" : {
|
||||
"urn:mace:example.com:it:tek":{
|
||||
|
@ -33,7 +29,7 @@ CONFIG = {
|
|||
}
|
||||
},
|
||||
"accepted_time_diff": 60,
|
||||
"attribute_map_dir" : "attributemaps",
|
||||
"attribute_map_dir" : full_path("attributemaps"),
|
||||
"organization": {
|
||||
"name": ("AB Exempel", "se"),
|
||||
"display_name": ("AB Exempel", "se"),
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
try:
|
||||
from saml2.sigver import get_xmlsec_binary
|
||||
xmlsec_path = get_xmlsec_binary(["/opt/local/bin"])
|
||||
except ImportError:
|
||||
xmlsec_path = '/usr/bin/xmlsec1'
|
||||
from pathutils import full_path, xmlsec_path
|
||||
|
||||
CONFIG={
|
||||
"entityid" : "urn:mace:example.com:saml:roland:sp",
|
||||
|
@ -19,12 +15,12 @@ CONFIG={
|
|||
}
|
||||
},
|
||||
"debug" : 1,
|
||||
"key_file" : "test.key",
|
||||
"cert_file" : "test.pem",
|
||||
"ca_certs": "cacerts.txt",
|
||||
"key_file" : full_path("test.key"),
|
||||
"cert_file" : full_path("test.pem"),
|
||||
"ca_certs": full_path("cacerts.txt"),
|
||||
"xmlsec_binary" : xmlsec_path,
|
||||
"metadata": {
|
||||
"local": ["idp.xml", "vo_metadata.xml"],
|
||||
"local": [full_path("idp.xml"), full_path("vo_metadata.xml")],
|
||||
},
|
||||
"virtual_organization" : {
|
||||
"urn:mace:example.com:it:tek":{
|
||||
|
@ -34,7 +30,7 @@ CONFIG={
|
|||
},
|
||||
"subject_data": "subject_data.db",
|
||||
"accepted_time_diff": 60,
|
||||
"attribute_map_dir" : "attributemaps",
|
||||
"attribute_map_dir" : full_path("attributemaps"),
|
||||
"valid_for": 6,
|
||||
"organization": {
|
||||
"name": ("AB Exempel", "se"),
|
||||
|
@ -51,7 +47,7 @@ CONFIG={
|
|||
],
|
||||
"logger": {
|
||||
"rotating": {
|
||||
"filename": "sp.log",
|
||||
"filename": full_path("sp.log"),
|
||||
"maxBytes": 100000,
|
||||
"backupCount": 5,
|
||||
},
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
__author__ = 'rolandh'
|
||||
|
||||
try:
|
||||
from saml2.sigver import get_xmlsec_binary
|
||||
xmlsec_path = get_xmlsec_binary(["/opt/local/bin"])
|
||||
except ImportError:
|
||||
xmlsec_path = '/usr/bin/xmlsec1'
|
||||
from pathutils import full_path
|
||||
|
||||
|
||||
CONFIG={
|
||||
"entityid" : "urn:mace:example.com:saml:roland:sp",
|
||||
|
@ -21,11 +18,11 @@ CONFIG={
|
|||
}
|
||||
},
|
||||
"debug" : 1,
|
||||
"key_file" : "test.key",
|
||||
"cert_file" : "test.pem",
|
||||
"key_file" : full_path("test.key"),
|
||||
"cert_file" : full_path("test.pem"),
|
||||
#"xmlsec_binary" : xmlsec_path,
|
||||
"metadata": {
|
||||
"local": ["idp.xml", "vo_metadata.xml"],
|
||||
"local": [full_path("idp.xml"), full_path("vo_metadata.xml")],
|
||||
},
|
||||
"virtual_organization" : {
|
||||
"urn:mace:example.com:it:tek":{
|
||||
|
@ -33,9 +30,9 @@ CONFIG={
|
|||
"common_identifier": "umuselin",
|
||||
}
|
||||
},
|
||||
"subject_data": "subject_data.db",
|
||||
"subject_data": full_path("subject_data.db"),
|
||||
"accepted_time_diff": 60,
|
||||
"attribute_map_dir" : "attributemaps",
|
||||
"attribute_map_dir" : full_path("attributemaps"),
|
||||
"organization": {
|
||||
"name": ("AB Exempel", "se"),
|
||||
"display_name": ("AB Exempel", "se"),
|
||||
|
|
|
@ -7,12 +7,7 @@ from saml2 import BINDING_HTTP_ARTIFACT
|
|||
from saml2.saml import NAMEID_FORMAT_TRANSIENT
|
||||
from saml2.saml import NAMEID_FORMAT_PERSISTENT
|
||||
|
||||
try:
|
||||
from saml2.sigver import get_xmlsec_binary
|
||||
xmlsec_path = get_xmlsec_binary(["/opt/local/bin"])
|
||||
except ImportError:
|
||||
xmlsec_path = '/usr/bin/xmlsec1'
|
||||
|
||||
from pathutils import full_path, xmlsec_path
|
||||
|
||||
BASE = "http://lingon.catalogix.se:8087"
|
||||
|
||||
|
@ -50,12 +45,12 @@ CONFIG={
|
|||
}
|
||||
},
|
||||
"debug": 1,
|
||||
"key_file": "test.key",
|
||||
"cert_file": "test.pem",
|
||||
"ca_certs": "cacerts.txt",
|
||||
"key_file": full_path("test.key"),
|
||||
"cert_file": full_path("test.pem"),
|
||||
"ca_certs": full_path("cacerts.txt"),
|
||||
"xmlsec_binary" : xmlsec_path,
|
||||
"metadata": {
|
||||
"local": ["idp_all.xml", "vo_metadata.xml"],
|
||||
"local": [full_path("idp_all.xml"), full_path("vo_metadata.xml")],
|
||||
},
|
||||
"virtual_organization": {
|
||||
"urn:mace:example.com:it:tek":{
|
||||
|
@ -65,7 +60,7 @@ CONFIG={
|
|||
},
|
||||
"subject_data": "subject_data.db",
|
||||
"accepted_time_diff": 60,
|
||||
"attribute_map_dir": "attributemaps",
|
||||
"attribute_map_dir": full_path("attributemaps"),
|
||||
#"valid_for": 6,
|
||||
"organization": {
|
||||
"name": ("AB Exempel", "se"),
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
try:
|
||||
from saml2.sigver import get_xmlsec_binary
|
||||
xmlsec_path = get_xmlsec_binary(["/opt/local/bin"])
|
||||
except ImportError:
|
||||
xmlsec_path = '/usr/bin/xmlsec1'
|
||||
from pathutils import full_path, xmlsec_path
|
||||
|
||||
|
||||
CONFIG = {
|
||||
"entityid" : "urn:mace:example.com:saml:roland:sp",
|
||||
|
@ -19,11 +16,11 @@ CONFIG = {
|
|||
}
|
||||
},
|
||||
"debug" : 1,
|
||||
"key_file" : "test.key",
|
||||
"cert_file" : "test.pem",
|
||||
"key_file" : full_path("test.key"),
|
||||
"cert_file" : full_path("test.pem"),
|
||||
"xmlsec_binary" : xmlsec_path,
|
||||
"metadata": {
|
||||
"local": ["idp.xml", "vo_metadata.xml"],
|
||||
"local": [full_path("idp.xml"), full_path("vo_metadata.xml")],
|
||||
},
|
||||
"virtual_organization" : {
|
||||
"urn:mace:example.com:it:tek":{
|
||||
|
@ -31,9 +28,9 @@ CONFIG = {
|
|||
"common_identifier": "umuselin",
|
||||
}
|
||||
},
|
||||
"subject_data": "subject_data.db",
|
||||
"subject_data": full_path("subject_data.db"),
|
||||
"accepted_time_diff": 60,
|
||||
"attribute_map_dir" : "attributemaps",
|
||||
"attribute_map_dir" : full_path("attributemaps"),
|
||||
"organization": {
|
||||
"name": ("AB Exempel", "se"),
|
||||
"display_name": ("AB Exempel", "se"),
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
try:
|
||||
from saml2.sigver import get_xmlsec_binary
|
||||
xmlsec_path = get_xmlsec_binary(["/opt/local/bin"])
|
||||
except ImportError:
|
||||
xmlsec_path = '/usr/bin/xmlsec1'
|
||||
from pathutils import full_path, xmlsec_path
|
||||
|
||||
CONFIG = {
|
||||
"entityid" : "urn:mace:example.com:saml:roland:sp",
|
||||
|
@ -19,11 +15,11 @@ CONFIG = {
|
|||
}
|
||||
},
|
||||
"debug" : 1,
|
||||
"key_file" : "test.key",
|
||||
"cert_file" : "test.pem",
|
||||
"key_file" : full_path("test.key"),
|
||||
"cert_file" : full_path("test.pem"),
|
||||
"xmlsec_binary" : xmlsec_path,
|
||||
"metadata": {
|
||||
"local": ["idp_2.xml"],
|
||||
"local": [full_path("idp_2.xml")],
|
||||
},
|
||||
"virtual_organization" : {
|
||||
"urn:mace:example.com:it:tek":{
|
||||
|
@ -31,9 +27,9 @@ CONFIG = {
|
|||
"common_identifier": "umuselin",
|
||||
}
|
||||
},
|
||||
"subject_data": "subject_data.db",
|
||||
"subject_data": full_path("subject_data.db"),
|
||||
"accepted_time_diff": 60,
|
||||
"attribute_map_dir" : "attributemaps",
|
||||
"attribute_map_dir" : full_path("attributemaps"),
|
||||
"organization": {
|
||||
"name": ("AB Exempel", "se"),
|
||||
"display_name": ("AB Exempel", "se"),
|
||||
|
|
|
@ -2,11 +2,7 @@ from saml2 import BINDING_HTTP_REDIRECT
|
|||
from saml2.saml import NAMEID_FORMAT_PERSISTENT
|
||||
from saml2.saml import NAME_FORMAT_URI
|
||||
|
||||
try:
|
||||
from saml2.sigver import get_xmlsec_binary
|
||||
xmlsec_path = get_xmlsec_binary(["/opt/local/bin"])
|
||||
except ImportError:
|
||||
xmlsec_path = '/usr/bin/xmlsec1'
|
||||
from pathutils import full_path, xmlsec_path
|
||||
|
||||
HOME = "http://lingon.catalogix.se:8087/"
|
||||
CONFIG = {
|
||||
|
@ -24,15 +20,15 @@ CONFIG = {
|
|||
"required_attributes": ["surName", "givenName", "mail"],
|
||||
"optional_attributes": ["title"],
|
||||
"idp": ["urn:mace:example.com:saml:roland:idp"],
|
||||
"subject_data": "subject_data.db",
|
||||
"subject_data": full_path("subject_data.db"),
|
||||
}
|
||||
},
|
||||
"debug" : 1,
|
||||
"key_file" : "test.key",
|
||||
"cert_file" : "test.pem",
|
||||
"key_file" : full_path("test.key"),
|
||||
"cert_file" : full_path("test.pem"),
|
||||
"xmlsec_binary" : xmlsec_path,
|
||||
"metadata": {
|
||||
"local": ["idp_slo_redirect.xml"],
|
||||
"local": [full_path("idp_slo_redirect.xml")],
|
||||
},
|
||||
"virtual_organization" : {
|
||||
"urn:mace:example.com:it:tek":{
|
||||
|
@ -41,7 +37,7 @@ CONFIG = {
|
|||
}
|
||||
},
|
||||
"accepted_time_diff": 60,
|
||||
"attribute_map_dir" : "attributemaps",
|
||||
"attribute_map_dir" : full_path("attributemaps"),
|
||||
"organization": {
|
||||
"name": ("AB Exempel", "se"),
|
||||
"display_name": ("AB Exempel", "se"),
|
||||
|
|
|
@ -19,6 +19,8 @@ from saml2.saml import Attribute, NAME_FORMAT_URI, AttributeValue
|
|||
|
||||
from py.test import raises
|
||||
|
||||
from pathutils import full_path
|
||||
|
||||
SUCCESS_STATUS = """<?xml version=\'1.0\' encoding=\'UTF-8\'?>
|
||||
<ns0:Status xmlns:ns0="urn:oasis:names:tc:SAML:2.0:protocol"><ns0:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success" /></ns0:Status>"""
|
||||
|
||||
|
@ -273,7 +275,7 @@ def test_subject():
|
|||
# ---------------------------------------------------------------------------
|
||||
|
||||
def test_parse_attribute_map():
|
||||
(forward, backward) = utils.parse_attribute_map(["attribute.map"])
|
||||
(forward, backward) = utils.parse_attribute_map([full_path("attribute.map")])
|
||||
|
||||
assert _eq(forward.keys(), backward.values())
|
||||
assert _eq(forward.values(), backward.keys())
|
||||
|
@ -300,7 +302,7 @@ def test_parse_attribute_map():
|
|||
|
||||
|
||||
def test_identity_attribute_0():
|
||||
(forward, backward) = utils.parse_attribute_map(["attribute.map"])
|
||||
(forward, backward) = utils.parse_attribute_map([full_path("attribute.map")])
|
||||
a = Attribute(name="urn:oid:2.5.4.4", name_format=NAME_FORMAT_URI,
|
||||
friendly_name="surName")
|
||||
|
||||
|
@ -308,14 +310,14 @@ def test_identity_attribute_0():
|
|||
assert utils.identity_attribute("friendly",a,forward) == "surName"
|
||||
|
||||
def test_identity_attribute_1():
|
||||
(forward, backward) = utils.parse_attribute_map(["attribute.map"])
|
||||
(forward, backward) = utils.parse_attribute_map([full_path("attribute.map")])
|
||||
a = Attribute(name="urn:oid:2.5.4.4", name_format=NAME_FORMAT_URI)
|
||||
|
||||
assert utils.identity_attribute("name",a,forward) == "urn:oid:2.5.4.4"
|
||||
assert utils.identity_attribute("friendly",a,forward) == "surName"
|
||||
|
||||
def test_identity_attribute_2():
|
||||
(forward, backward) = utils.parse_attribute_map(["attribute.map"])
|
||||
(forward, backward) = utils.parse_attribute_map([full_path("attribute.map")])
|
||||
a = Attribute(name="urn:oid:2.5.4.5", name_format=NAME_FORMAT_URI)
|
||||
|
||||
assert utils.identity_attribute("name",a,forward) == "urn:oid:2.5.4.5"
|
||||
|
@ -450,4 +452,4 @@ def test_signature():
|
|||
|
||||
assert utils.verify_signature("abcdef", arr)
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -18,6 +18,8 @@ from saml2 import saml
|
|||
import xmldsig
|
||||
import xmlenc
|
||||
|
||||
from pathutils import full_path
|
||||
|
||||
ONTS = [saml, mdui, mdattr, dri, ui, idpdisc, md, xmldsig, xmlenc]
|
||||
|
||||
def _eq(l1,l2):
|
||||
|
@ -283,7 +285,7 @@ def test_assertion_2():
|
|||
})
|
||||
|
||||
ava = ava.apply_policy( "", policy )
|
||||
acs = ac_factory("attributemaps")
|
||||
acs = ac_factory(full_path("attributemaps"))
|
||||
attribute=from_local(acs, ava, policy.get_name_form(""))
|
||||
|
||||
assert len(attribute) == 4
|
||||
|
@ -418,7 +420,7 @@ def test_filter_values_req_opt_4():
|
|||
name="urn:oid:2.5.4.12",
|
||||
name_format="urn:oasis:names:tc:SAML:2.0:attrname-format:uri")]
|
||||
|
||||
acs = attribute_converter.ac_factory("attributemaps")
|
||||
acs = attribute_converter.ac_factory(full_path("attributemaps"))
|
||||
|
||||
rava = attribute_converter.ava_fro(acs, r)
|
||||
oava = attribute_converter.ava_fro(acs, o)
|
||||
|
@ -589,7 +591,7 @@ def test_filter_on_wire_representation_1():
|
|||
name="urn:oid:2.5.4.12",
|
||||
name_format="urn:oasis:names:tc:SAML:2.0:attrname-format:uri")]
|
||||
|
||||
acs = attribute_converter.ac_factory("attributemaps")
|
||||
acs = attribute_converter.ac_factory(full_path("attributemaps"))
|
||||
|
||||
ava = { "sn":["Hedberg"], "givenname":["Roland"],
|
||||
"edupersonaffiliation":["staff"],"uid":["rohe0002"]}
|
||||
|
@ -608,10 +610,10 @@ def test_filter_on_wire_representation_2():
|
|||
name="urn:oid:2.5.4.12",
|
||||
name_format="urn:oasis:names:tc:SAML:2.0:attrname-format:uri")]
|
||||
|
||||
acs = attribute_converter.ac_factory("attributemaps")
|
||||
acs = attribute_converter.ac_factory(full_path("attributemaps"))
|
||||
|
||||
ava = { "sn":["Hedberg"], "givenname":["Roland"],
|
||||
"title":["Master"],"uid":["rohe0002"]}
|
||||
|
||||
ava = assertion.filter_on_wire_representation(ava, acs, r, o)
|
||||
assert _eq(ava.keys(), ["sn", "givenname", "title"])
|
||||
assert _eq(ava.keys(), ["sn", "givenname", "title"])
|
||||
|
|
|
@ -4,6 +4,8 @@ from saml2 import attribute_converter, saml
|
|||
|
||||
from attribute_statement_data import *
|
||||
|
||||
from pathutils import full_path
|
||||
|
||||
def _eq(l1,l2):
|
||||
return set(l1) == set(l2)
|
||||
|
||||
|
@ -17,7 +19,7 @@ def test_default():
|
|||
|
||||
class TestAC():
|
||||
def setup_class(self):
|
||||
self.acs = attribute_converter.ac_factory("attributemaps")
|
||||
self.acs = attribute_converter.ac_factory(full_path("attributemaps"))
|
||||
|
||||
def test_setup(self):
|
||||
print self.acs
|
||||
|
@ -157,4 +159,4 @@ class TestAC():
|
|||
oava = basic_ac.fro(attr_state)
|
||||
|
||||
assert _eq(ava.keys(), oava.keys())
|
||||
|
||||
|
||||
|
|
|
@ -24,11 +24,7 @@ from saml2.s_utils import UnknownPrincipal
|
|||
import xmldsig
|
||||
import xmlenc
|
||||
|
||||
try:
|
||||
from saml2.sigver import get_xmlsec_binary
|
||||
xmlsec_path = get_xmlsec_binary(["/opt/local/bin"])
|
||||
except ImportError:
|
||||
xmlsec_path = '/usr/bin/xmlsec1'
|
||||
from pathutils import full_path, xmlsec_path
|
||||
|
||||
|
||||
ONTS = {
|
||||
|
@ -43,32 +39,33 @@ ONTS = {
|
|||
xmlenc.NAMESPACE: xmlenc
|
||||
}
|
||||
|
||||
ATTRCONV = ac_factory("attributemaps")
|
||||
ATTRCONV = ac_factory(full_path("attributemaps"))
|
||||
|
||||
METADATACONF = {
|
||||
"1": {
|
||||
"local": ["swamid-1.0.xml"]
|
||||
"local": [full_path("swamid-1.0.xml")]
|
||||
},
|
||||
"2": {
|
||||
"local": ["InCommon-metadata.xml"]
|
||||
"local": [full_path("InCommon-metadata.xml")]
|
||||
},
|
||||
"3": {
|
||||
"local": ["extended.xml"]
|
||||
"local": [full_path("extended.xml")]
|
||||
},
|
||||
"7": {
|
||||
"local": ["metadata_sp_1.xml", "InCommon-metadata.xml"],
|
||||
"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": "kalmar2.pem"}]
|
||||
"cert": full_path("kalmar2.pem")}]
|
||||
},
|
||||
"4": {
|
||||
"local": ["metadata_example.xml"]
|
||||
"local": [full_path("metadata_example.xml")]
|
||||
},
|
||||
"5": {
|
||||
"local": ["metadata.aaitest.xml"]
|
||||
"local": [full_path("metadata.aaitest.xml")]
|
||||
},
|
||||
"6": {
|
||||
"local": ["metasp.xml"]
|
||||
"local": [full_path("metasp.xml")]
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,8 @@ from py.test import raises
|
|||
|
||||
from saml2 import root_logger
|
||||
|
||||
from pathutils import full_path
|
||||
|
||||
sp1 = {
|
||||
"entityid" : "urn:mace:umu.se:saml:roland:sp",
|
||||
"service": {
|
||||
|
@ -26,12 +28,12 @@ sp1 = {
|
|||
}
|
||||
}
|
||||
},
|
||||
"key_file" : "mykey.pem",
|
||||
"cert_file" : "mycert.pem",
|
||||
"key_file" : full_path("mykey.pem"),
|
||||
"cert_file" : full_path("mycert.pem"),
|
||||
#"xmlsec_binary" : "/opt/local/bin/xmlsec1",
|
||||
"metadata": {
|
||||
"local": ["metadata.xml",
|
||||
"urn-mace-swami.se-swamid-test-1.0-metadata.xml"],
|
||||
"local": [full_path("metadata.xml"),
|
||||
full_path("urn-mace-swami.se-swamid-test-1.0-metadata.xml")],
|
||||
},
|
||||
"virtual_organization" : {
|
||||
"coip":{
|
||||
|
@ -42,7 +44,7 @@ sp1 = {
|
|||
]
|
||||
}
|
||||
},
|
||||
"attribute_map_dir": "attributemaps",
|
||||
"attribute_map_dir": full_path("attributemaps"),
|
||||
"only_use_keys_in_metadata": True,
|
||||
}
|
||||
|
||||
|
@ -124,8 +126,8 @@ PDP = {
|
|||
},
|
||||
}
|
||||
},
|
||||
"key_file" : "test.key",
|
||||
"cert_file" : "test.pem",
|
||||
"key_file" : full_path("test.key"),
|
||||
"cert_file" : full_path("test.pem"),
|
||||
"organization": {
|
||||
"name": "Exempel AB",
|
||||
"display_name": [("Exempel AB","se"),("Example Co.","en")],
|
||||
|
@ -295,11 +297,11 @@ def test_conf_syslog():
|
|||
#noinspection PyUnresolvedReferences
|
||||
def test_3():
|
||||
cnf = Config()
|
||||
cnf.load_file("sp_1_conf")
|
||||
cnf.load_file("tests.sp_1_conf")
|
||||
assert cnf.entityid == "urn:mace:example.com:saml:roland:sp"
|
||||
assert cnf.debug == 1
|
||||
assert cnf.key_file == "test.key"
|
||||
assert cnf.cert_file == "test.pem"
|
||||
assert cnf.key_file == full_path("test.key")
|
||||
assert cnf.cert_file == full_path("test.pem")
|
||||
#assert cnf.xmlsec_binary == "/usr/local/bin/xmlsec1"
|
||||
assert cnf.accepted_time_diff == 60
|
||||
assert cnf.secret == "0123456789"
|
||||
|
@ -308,12 +310,12 @@ def test_3():
|
|||
|
||||
def test_sp():
|
||||
cnf = SPConfig()
|
||||
cnf.load_file("sp_1_conf")
|
||||
cnf.load_file("tests.sp_1_conf")
|
||||
assert cnf.endpoint("assertion_consumer_service") == \
|
||||
["http://lingon.catalogix.se:8087/"]
|
||||
|
||||
def test_dual():
|
||||
cnf = Config().load_file("idp_sp_conf")
|
||||
cnf = Config().load_file("tests.idp_sp_conf")
|
||||
|
||||
spe = cnf.getattr("endpoints", "sp")
|
||||
idpe = cnf.getattr("endpoints", "idp")
|
||||
|
@ -333,10 +335,10 @@ def test_ecp():
|
|||
|
||||
def test_assertion_consumer_service():
|
||||
c = IdPConfig()
|
||||
c.load_file("idp_conf")
|
||||
c.load_file("tests.idp_conf")
|
||||
c.context = "idp"
|
||||
|
||||
c.metadata.load("local", "InCommon-metadata.xml")
|
||||
c.metadata.load("local", full_path("InCommon-metadata.xml"))
|
||||
|
||||
entity_id = "https://www.zimride.com/shibboleth"
|
||||
acs = c.metadata.assertion_consumer_service(entity_id)
|
||||
|
|
|
@ -14,13 +14,15 @@ from saml2.sigver import xmlsec_version, get_xmlsec_cryptobackend, get_xmlsec_bi
|
|||
|
||||
from py.test import raises
|
||||
|
||||
SIGNED = "saml_signed.xml"
|
||||
UNSIGNED = "saml_unsigned.xml"
|
||||
FALSE_SIGNED = "saml_false_signed.xml"
|
||||
SIMPLE_SAML_PHP_RESPONSE = "simplesamlphp_authnresponse.xml"
|
||||
from pathutils import full_path
|
||||
|
||||
PUB_KEY = "test.pem"
|
||||
PRIV_KEY = "test.key"
|
||||
SIGNED = full_path("saml_signed.xml")
|
||||
UNSIGNED = full_path("saml_unsigned.xml")
|
||||
FALSE_SIGNED = full_path("saml_false_signed.xml")
|
||||
SIMPLE_SAML_PHP_RESPONSE = full_path("simplesamlphp_authnresponse.xml")
|
||||
|
||||
PUB_KEY = full_path("test.pem")
|
||||
PRIV_KEY = full_path("test.key")
|
||||
|
||||
|
||||
def _eq(l1,l2):
|
||||
|
@ -360,7 +362,7 @@ class TestSecurityMetadata():
|
|||
def setup_class(self):
|
||||
xmlexec = get_xmlsec_binary()
|
||||
md = MetadataStore([saml, samlp], None, xmlexec)
|
||||
md.load("local", "metadata_cert.xml")
|
||||
md.load("local", full_path("metadata_cert.xml"))
|
||||
|
||||
crypto = get_xmlsec_cryptobackend()
|
||||
self.sec = sigver.SecurityContext(crypto, key_file=PRIV_KEY,
|
||||
|
|
|
@ -7,8 +7,10 @@ from saml2.server import Server
|
|||
from saml2.response import authn_response
|
||||
from saml2.config import config_factory
|
||||
|
||||
XML_RESPONSE_FILE = "saml_signed.xml"
|
||||
XML_RESPONSE_FILE2 = "saml2_response.xml"
|
||||
from pathutils import full_path
|
||||
|
||||
XML_RESPONSE_FILE = full_path("saml_signed.xml")
|
||||
XML_RESPONSE_FILE2 = full_path("saml2_response.xml")
|
||||
|
||||
def _eq(l1,l2):
|
||||
return set(l1) == set(l2)
|
||||
|
@ -20,7 +22,7 @@ IDENTITY = {"eduPersonAffiliation": ["staff", "member"],
|
|||
|
||||
class TestAuthnResponse:
|
||||
def setup_class(self):
|
||||
server = Server("idp_conf")
|
||||
server = Server("tests.idp_conf")
|
||||
name_id = server.ident.transient_nameid(
|
||||
"urn:mace:example.com:saml:roland:sp","id12")
|
||||
authn = (AUTHN_PASSWORD, "http://www.example.com/login")
|
||||
|
@ -49,7 +51,7 @@ class TestAuthnResponse:
|
|||
name_id = name_id,
|
||||
authn=authn)
|
||||
|
||||
self.conf = config_factory("sp", "server_conf")
|
||||
self.conf = config_factory("sp", "tests.server_conf")
|
||||
self.conf.only_use_keys_in_metadata = False
|
||||
self.ar = authn_response(self.conf, "http://lingon.catalogix.se:8087/")
|
||||
|
||||
|
|
|
@ -14,6 +14,8 @@ from saml2 import create_class_from_xml_string
|
|||
from saml2.profile import ecp as ecp_prof
|
||||
from saml2.client import Saml2Client
|
||||
|
||||
from pathutils import full_path, xmlsec_path
|
||||
|
||||
__author__ = 'rolandh'
|
||||
|
||||
|
||||
|
@ -23,26 +25,17 @@ def _eq(l1, l2):
|
|||
else:
|
||||
return len(l1) == len(l2)
|
||||
|
||||
try:
|
||||
from saml2.sigver import get_xmlsec_binary
|
||||
except ImportError:
|
||||
get_xmlsec_binary = None
|
||||
|
||||
if get_xmlsec_binary:
|
||||
xmlsec_path = get_xmlsec_binary(["/opt/local/bin"])
|
||||
else:
|
||||
xmlsec_path = '/usr/bin/xmlsec1'
|
||||
|
||||
class DummyResponse(object):
|
||||
def __init__(self, headers):
|
||||
self.headers = headers
|
||||
|
||||
def test_complete_flow():
|
||||
client = ecp_client.Client("user", "password", metadata_file="idp_all.xml",
|
||||
client = ecp_client.Client("user", "password",
|
||||
metadata_file=full_path("idp_all.xml"),
|
||||
xmlsec_binary=xmlsec_path)
|
||||
|
||||
sp = Saml2Client(config_file="servera_conf")
|
||||
idp = Server(config_file="idp_all_conf")
|
||||
sp = Saml2Client(config_file="tests.servera_conf")
|
||||
idp = Server(config_file="tests.idp_all_conf")
|
||||
|
||||
IDP_ENTITY_ID = idp.config.entityid
|
||||
#SP_ENTITY_ID = sp.config.entityid
|
||||
|
|
|
@ -7,26 +7,26 @@ def _eq(l1,l2):
|
|||
return set(l1) == set(l2)
|
||||
|
||||
def test_verify():
|
||||
ds = DiscoveryServer(config_file="disco_conf")
|
||||
ds = DiscoveryServer(config_file="tests.disco_conf")
|
||||
assert ds
|
||||
assert ds.verify_sp_in_metadata("urn:mace:example.com:saml:roland:sp")
|
||||
|
||||
def test_construct_0():
|
||||
sp = Saml2Client(config_file="servera_conf")
|
||||
sp = Saml2Client(config_file="tests.servera_conf")
|
||||
url = sp.create_discovery_service_request("http://example.com/saml/disco",
|
||||
"https://example.com/saml/sp.xml")
|
||||
|
||||
assert url == "http://example.com/saml/disco?entityID=https%3A%2F%2Fexample.com%2Fsaml%2Fsp.xml"
|
||||
|
||||
def test_construct_1():
|
||||
sp = Saml2Client(config_file="servera_conf")
|
||||
sp = Saml2Client(config_file="tests.servera_conf")
|
||||
url = sp.create_discovery_service_request("http://example.com/saml/disco",
|
||||
"https://example.com/saml/sp.xml")
|
||||
|
||||
assert url == "http://example.com/saml/disco?entityID=https%3A%2F%2Fexample.com%2Fsaml%2Fsp.xml"
|
||||
|
||||
def test_construct_deconstruct_request():
|
||||
sp = Saml2Client(config_file="servera_conf")
|
||||
sp = Saml2Client(config_file="tests.servera_conf")
|
||||
url = sp.create_discovery_service_request("http://example.com/saml/disco",
|
||||
"https://example.com/saml/sp.xml",
|
||||
is_passive=True,
|
||||
|
@ -35,20 +35,20 @@ def test_construct_deconstruct_request():
|
|||
|
||||
print url
|
||||
|
||||
ds = DiscoveryServer(config_file="disco_conf")
|
||||
ds = DiscoveryServer(config_file="tests.disco_conf")
|
||||
dsr = ds.parse_discovery_service_request(url)
|
||||
# policy is added by the parsing and verifying method
|
||||
assert _eq(dsr.keys(),["return_url", "entityID", "returnIDParam",
|
||||
"isPassive", "policy"])
|
||||
|
||||
def test_construct_deconstruct_response():
|
||||
sp = Saml2Client(config_file="servera_conf")
|
||||
sp = Saml2Client(config_file="tests.servera_conf")
|
||||
url = sp.create_discovery_service_request("http://example.com/saml/disco",
|
||||
"https://example.com/saml/sp.xml",
|
||||
is_passive=True,
|
||||
returnIDParam="foo",
|
||||
return_url="https://example.com/saml/sp/disc")
|
||||
ds = DiscoveryServer(config_file="disco_conf")
|
||||
ds = DiscoveryServer(config_file="tests.disco_conf")
|
||||
dsr = ds.parse_discovery_service_request(url)
|
||||
args = dict([(key, dsr[key]) for key in ["returnIDParam", "return_url"]])
|
||||
url = ds.create_discovery_service_response(
|
||||
|
@ -56,4 +56,4 @@ def test_construct_deconstruct_response():
|
|||
**args)
|
||||
|
||||
idp_id = sp.parse_discovery_service_response(url, returnIDParam="foo")
|
||||
assert idp_id == "https://example.com/saml/idp.xml"
|
||||
assert idp_id == "https://example.com/saml/idp.xml"
|
||||
|
|
|
@ -10,10 +10,10 @@ from urlparse import parse_qs
|
|||
|
||||
__author__ = 'rolandh'
|
||||
|
||||
idp = Server(config_file="idp_all_conf")
|
||||
idp = Server(config_file="tests.idp_all_conf")
|
||||
|
||||
conf = SPConfig()
|
||||
conf.load_file("servera_conf")
|
||||
conf.load_file("tests.servera_conf")
|
||||
sp = Saml2Client(conf)
|
||||
|
||||
def test():
|
||||
|
@ -41,4 +41,4 @@ def test():
|
|||
if verify_redirect_signature(_dict, cert):
|
||||
verified_ok = True
|
||||
|
||||
assert verified_ok
|
||||
assert verified_ok
|
||||
|
|
Loading…
Reference in New Issue