summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClint Byrum <clint@fewbar.com>2015-05-25 16:26:26 -0700
committerClint Byrum <clint@fewbar.com>2015-05-28 09:50:57 -0700
commit1ddc08022a2ad7384f772ea45befe61ca00c9bf3 (patch)
tree39be6f48513025526e6dddae9ce6d11704a93e2f
parent38c250d8f1c08d440dd4bd9e6059a88097e427b0 (diff)
downloadpysaml2-1ddc08022a2ad7384f772ea45befe61ca00c9bf3.tar.gz
Fix minor python3 issues in config tests
* sys.version is not suitable for comparisons, and strings and tuples don't compare like that in python3 anyway. Fixing to use sys.version_info. * More views that need to be casted to lists.
-rw-r--r--tests/test_31_config.py19
1 files changed, 10 insertions, 9 deletions
diff --git a/tests/test_31_config.py b/tests/test_31_config.py
index e8d46842..373c9364 100644
--- a/tests/test_31_config.py
+++ b/tests/test_31_config.py
@@ -180,11 +180,11 @@ def test_1():
assert isinstance(md, MetadataStore)
assert len(c._sp_idp) == 1
- assert c._sp_idp.keys() == ["urn:mace:example.com:saml:roland:idp"]
- assert c._sp_idp.values() == [{'single_sign_on_service':
- {
- 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect':
- 'http://localhost:8088/sso/'}}]
+ assert list(c._sp_idp.keys()) == ["urn:mace:example.com:saml:roland:idp"]
+ assert list(c._sp_idp.values()) == [{'single_sign_on_service':
+ {
+ 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect':
+ 'http://localhost:8088/sso/'}}]
assert c.only_use_keys_in_metadata
@@ -202,8 +202,8 @@ def test_2():
assert c._sp_required_attributes
assert len(c._sp_idp) == 1
- assert c._sp_idp.keys() == [""]
- assert c._sp_idp.values() == [
+ assert list(c._sp_idp.keys()) == [""]
+ assert list(c._sp_idp.values()) == [
"https://example.com/saml2/idp/SSOService.php"]
assert c.only_use_keys_in_metadata is True
@@ -263,7 +263,7 @@ def test_wayf():
c.context = "sp"
idps = c.metadata.with_descriptor("idpsso")
- ent = idps.values()[0]
+ ent = list(idps.values())[0]
assert name(ent) == 'Example Co.'
assert name(ent, "se") == 'Exempel AB'
@@ -305,7 +305,8 @@ def test_conf_syslog():
print(handler.__dict__)
assert handler.facility == "local3"
assert handler.address == ('localhost', 514)
- if sys.version >= (2, 7):
+ if ((sys.version_info.major == 2 and sys.version_info.minor >= 7) or
+ sys.version_info.major > 2):
assert handler.socktype == 2
else:
pass