diff options
author | Roland Hedberg <roland.hedberg@adm.umu.se> | 2016-04-16 09:01:21 +0200 |
---|---|---|
committer | Roland Hedberg <roland.hedberg@adm.umu.se> | 2016-04-16 09:01:21 +0200 |
commit | 9e25cc73728e67cdafe07850566796ba0ce81473 (patch) | |
tree | 4298842a6be0789c902454740b9d4288791c0372 /tests | |
parent | 9dd3ee910aed4fb6b322b9ab022b044c7e753ab4 (diff) | |
download | pysaml2-9e25cc73728e67cdafe07850566796ba0ce81473.tar.gz |
Added functionality needed by the saml2test tool.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_06_setarg.py | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/test_06_setarg.py b/tests/test_06_setarg.py new file mode 100644 index 00000000..171fefb3 --- /dev/null +++ b/tests/test_06_setarg.py @@ -0,0 +1,44 @@ +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 find_paths + +__author__ = 'roland' + + +def test_path(): + result = find_paths(Subject, 'in_response_to') + + assert result == [ + ['subject_confirmation', 'subject_confirmation_data', 'in_response_to']] + + result = find_paths(Response, 'in_response_to') + + assert result == [ + ['assertion', 'subject', 'subject_confirmation', + 'subject_confirmation_data', 'in_response_to'], + ['in_response_to'] + ] + + +def test_set_arg(): + r = set_arg(Subject, 'in_response_to', '123456') + + assert r == [{'subject_confirmation': { + 'subject_confirmation_data': {'in_response_to': '123456'}}}] + + +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']) + + 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 |