Fix basic python3 issues in test_02_saml
- Strings/bytes encoding/decoding where necessary. - Random hash seed producing test fails sometimes on keys(), sorting lists fixes this.
This commit is contained in:
parent
efa12f0860
commit
9ec77050e8
@ -119,7 +119,7 @@ def _verify_value_type(typ, val):
|
||||
if typ == XSD + "base64Binary":
|
||||
import base64
|
||||
|
||||
return base64.decodestring(val)
|
||||
return base64.decodestring(val.encode('utf-8'))
|
||||
|
||||
|
||||
class AttributeValueBase(SamlBase):
|
||||
|
@ -183,7 +183,7 @@ class TestExtensionContainer:
|
||||
ec = saml2.ExtensionContainer()
|
||||
ec.add_extension_attribute("foo", "bar")
|
||||
assert len(ec.extension_attributes) == 1
|
||||
assert ec.extension_attributes.keys()[0] == "foo"
|
||||
assert list(ec.extension_attributes.keys())[0] == "foo"
|
||||
|
||||
|
||||
class TestSAMLBase:
|
||||
@ -216,13 +216,14 @@ class TestSAMLBase:
|
||||
|
||||
attr = Attribute()
|
||||
saml2.make_vals(ava, AttributeValue, attr, prop="attribute_value")
|
||||
assert attr.keyswv() == ["name_format", "attribute_value"]
|
||||
assert sorted(attr.keyswv()) == sorted(["name_format",
|
||||
"attribute_value"])
|
||||
assert len(attr.attribute_value) == 4
|
||||
|
||||
def test_to_string_nspair(self):
|
||||
foo = saml2.make_vals("lions", AttributeValue, part=True)
|
||||
txt = foo.to_string()
|
||||
nsstr = foo.to_string({"saml": saml.NAMESPACE})
|
||||
txt = foo.to_string().decode('utf-8')
|
||||
nsstr = foo.to_string({"saml": saml.NAMESPACE}).decode('utf-8')
|
||||
assert nsstr != txt
|
||||
print(txt)
|
||||
print(nsstr)
|
||||
@ -1215,4 +1216,4 @@ class TestAssertion:
|
||||
|
||||
if __name__ == "__main__":
|
||||
t = TestSAMLBase()
|
||||
t.test_make_vals_multi_dict()
|
||||
t.test_make_vals_multi_dict()
|
||||
|
Loading…
Reference in New Issue
Block a user