summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRoland Hedberg <roland.hedberg@adm.umu.se>2016-05-16 20:50:42 +0200
committerRoland Hedberg <roland.hedberg@adm.umu.se>2016-05-16 20:50:42 +0200
commita73e11bfc2b0b994b9f0010e6af386e935a6a939 (patch)
tree5de1ae2dc63c9d8a6104ca692c2a056a635b37e0 /tests
parent9ef92af7d8d444be4269cd9a35342deb58850a18 (diff)
downloadpysaml2-a73e11bfc2b0b994b9f0010e6af386e935a6a939.tar.gz
Allow more direct modifications of nested items.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_06_setarg.py21
-rw-r--r--tests/test_30_mdstore.py6
-rw-r--r--tests/test_36_mdbcache.py2
-rw-r--r--tests/test_75_mongodb.py3
4 files changed, 24 insertions, 8 deletions
diff --git a/tests/test_06_setarg.py b/tests/test_06_setarg.py
index 171fefb3..7df32179 100644
--- a/tests/test_06_setarg.py
+++ b/tests/test_06_setarg.py
@@ -1,7 +1,7 @@
from saml2 import saml
from saml2.saml import Subject
from saml2.samlp import Response
-from saml2.argtree import set_arg, add_path
+from saml2.argtree import set_arg, add_path, is_set
from saml2.argtree import find_paths
__author__ = 'roland'
@@ -32,13 +32,22 @@ def test_set_arg():
def test_multi():
t = {}
t = add_path(t, ['subject_confirmation','method',saml.SCM_BEARER])
- x = add_path(
- t['subject_confirmation'],
- ['subject_confirmation_data','in_response_to','1234'])
+ add_path(t['subject_confirmation'],
+ ['subject_confirmation_data','in_response_to','1234'])
- print(t)
assert t == {
'subject_confirmation': {
'subject_confirmation_data': {'in_response_to': '1234'},
'method': 'urn:oasis:names:tc:SAML:2.0:cm:bearer'}
- } \ No newline at end of file
+ }
+
+
+def test_is_set():
+ t = {}
+ t = add_path(t, ['subject_confirmation','method',saml.SCM_BEARER])
+ add_path(t['subject_confirmation'],
+ ['subject_confirmation_data','in_response_to','1234'])
+
+ assert is_set(t, ['subject_confirmation','method'])
+ assert is_set(t, ['subject_confirmation', 'subject_confirmation_data',
+ 'receiver']) is False
diff --git a/tests/test_30_mdstore.py b/tests/test_30_mdstore.py
index 7bc95c66..d4dd166a 100644
--- a/tests/test_30_mdstore.py
+++ b/tests/test_30_mdstore.py
@@ -2,8 +2,9 @@
# -*- coding: utf-8 -*-
import datetime
import re
-from six.moves.urllib.parse import quote_plus
-#from future.backports.urllib.parse import quote_plus
+
+from future.backports.urllib.parse import quote_plus
+
from saml2.config import Config
from saml2.mdstore import MetadataStore
from saml2.mdstore import MetaDataMDX
@@ -447,6 +448,7 @@ def test_get_certs_from_metadata_without_keydescriptor():
assert len(certs) == 0
+
def test_metadata_extension_algsupport():
mds = MetadataStore(ATTRCONV, None)
mds.imp(METADATACONF["12"])
diff --git a/tests/test_36_mdbcache.py b/tests/test_36_mdbcache.py
index 7b36539a..66826f12 100644
--- a/tests/test_36_mdbcache.py
+++ b/tests/test_36_mdbcache.py
@@ -1,4 +1,5 @@
#!/usr/bin/env python
+import pytest
__author__ = 'rolandh'
@@ -11,6 +12,7 @@ from pytest import raises
SESSION_INFO_PATTERN = {"ava":{}, "came from":"", "not_on_or_after":0,
"issuer":"", "session_id":-1}
+@pytest.mark.mongo
class TestMongoDBCache():
def setup_class(self):
try:
diff --git a/tests/test_75_mongodb.py b/tests/test_75_mongodb.py
index 9d9893c1..a6644536 100644
--- a/tests/test_75_mongodb.py
+++ b/tests/test_75_mongodb.py
@@ -1,5 +1,6 @@
from contextlib import closing
from pymongo.errors import ConnectionFailure, ServerSelectionTimeoutError
+import pytest
from saml2 import BINDING_HTTP_POST
from saml2.authn_context import INTERNETPROTOCOLPASSWORD
from saml2.client import Saml2Client
@@ -19,6 +20,7 @@ def _eq(l1, l2):
return set(l1) == set(l2)
+@pytest.mark.mongo
def test_flow():
sp = Saml2Client(config_file="servera_conf")
try:
@@ -63,6 +65,7 @@ def test_flow():
pass
+@pytest.mark.mongo
def test_eptid_mongo_db():
try:
edb = EptidMDB("secret", "idp")