summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland Hedberg <roland@catalogix.se>2017-10-11 08:35:28 +0200
committerGitHub <noreply@github.com>2017-10-11 08:35:28 +0200
commit0075b9ca0d711e81e747f8313afcd8642210fd8f (patch)
tree69cb8fb94681a3273d1fe995e0e79bb047d307cf
parent9e6ddc0030828a17fe44a3ecdc5c95b6b6c8d741 (diff)
parentb71f1443991c94099ff49226c92b8671d657fade (diff)
downloadpysaml2-0075b9ca0d711e81e747f8313afcd8642210fd8f.tar.gz
Merge pull request #400 from hpk/master
Remove optional dependencies from install_requires
-rwxr-xr-xsetup.py13
-rw-r--r--tests/test_40_sigver.py29
-rw-r--r--tests/test_60_sp.py9
3 files changed, 34 insertions, 17 deletions
diff --git a/setup.py b/setup.py
index b29c31ca..3116e9af 100755
--- a/setup.py
+++ b/setup.py
@@ -8,12 +8,8 @@ from setuptools.command.test import test as TestCommand
install_requires = [
# core dependencies
- 'decorator',
'requests >= 1.0.0',
'future',
- 'paste',
- 'zope.interface',
- 'repoze.who',
'cryptography',
'pytz',
'pyOpenSSL',
@@ -22,6 +18,14 @@ install_requires = [
'six'
]
+extras_require = {
+ 's2repoze': [
+ 'paste',
+ 'zope.interface',
+ 'repoze.who'
+ ]
+}
+
version = ''
with open('src/saml2/__init__.py', 'r') as fd:
version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]',
@@ -56,5 +60,6 @@ setup(
scripts=["tools/parse_xsd2.py", "tools/make_metadata.py",
"tools/mdexport.py", "tools/merge_metadata.py"],
install_requires=install_requires,
+ extras_require=extras_require,
zip_safe=False,
)
diff --git a/tests/test_40_sigver.py b/tests/test_40_sigver.py
index 48cf19f2..2511efc4 100644
--- a/tests/test_40_sigver.py
+++ b/tests/test_40_sigver.py
@@ -18,8 +18,7 @@ from saml2.saml import EncryptedAssertion
from saml2.samlp import response_from_string
from saml2.s_utils import factory, do_attribute_statement
-#from pyasn1.codec.der import decoder
-
+import pytest
from py.test import raises
from pathutils import full_path
@@ -69,6 +68,10 @@ Yj4cAafWaYfjBU2zi1ElwStIaJ5nyp/s/8B8SAPK2T79McMyccP3wSW13LHkmM1j
wKe3ACFXBvqGQN0IbcH49hu0FKhYFM/GPDJcIHFBsiyMBXChpye9vBaTNEBCtU3K
jjyG0hRT2mAQ9h+bkPmOvlEo/aH0xR68Z9hw4PF13w=="""
+try:
+ from pyasn1.codec.der import decoder
+except ImportError:
+ decoder = None
def test_cert_from_instance_1():
@@ -81,16 +84,18 @@ def test_cert_from_instance_1():
assert certs[0] == CERT1
-# def test_cert_from_instance_ssp():
-# xml_response = open(SIMPLE_SAML_PHP_RESPONSE).read()
-# response = samlp.response_from_string(xml_response)
-# assertion = response.assertion[0]
-# certs = sigver.cert_from_instance(assertion)
-# assert len(certs) == 1
-# assert certs[0] == CERT_SSP
-# der = base64.b64decode(certs[0])
-# print(str(decoder.decode(der)).replace('.', "\n."))
-# assert decoder.decode(der)
+@pytest.mark.skipif(not decoder,
+ reason="pyasn1 is not installed")
+def test_cert_from_instance_ssp():
+ xml_response = open(SIMPLE_SAML_PHP_RESPONSE).read()
+ response = samlp.response_from_string(xml_response)
+ assertion = response.assertion[0]
+ certs = sigver.cert_from_instance(assertion)
+ assert len(certs) == 1
+ assert certs[0] == CERT_SSP
+ der = base64.b64decode(certs[0])
+ print(str(decoder.decode(der)).replace('.', "\n."))
+ assert decoder.decode(der)
class FakeConfig():
diff --git a/tests/test_60_sp.py b/tests/test_60_sp.py
index 6448d6d8..65504635 100644
--- a/tests/test_60_sp.py
+++ b/tests/test_60_sp.py
@@ -2,12 +2,17 @@
# -*- coding: utf-8 -*-
import base64
+import pytest
from saml2.authn_context import INTERNETPROTOCOLPASSWORD
from saml2.saml import NAMEID_FORMAT_TRANSIENT
from saml2.samlp import NameIDPolicy
-from saml2.s2repoze.plugins.sp import make_plugin
from saml2.server import Server
+try:
+ from saml2.s2repoze.plugins.sp import make_plugin
+except ImportError:
+ make_plugin = None
+
ENV1 = {'SERVER_SOFTWARE': 'CherryPy/3.1.2 WSGI Server',
'SCRIPT_NAME': '',
'ACTUAL_SERVER_PROTOCOL': 'HTTP/1.1',
@@ -43,6 +48,8 @@ AUTHN = {
}
+@pytest.mark.skipif(not make_plugin,
+ reason="s2repoze dependencies not installed")
class TestSP():
def setup_class(self):
self.sp = make_plugin("rem", saml_conf="server_conf")