summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVlastimil Zíma <vlastimil.zima@nic.cz>2019-06-17 13:36:16 +0200
committerVlastimil Zíma <vlastimil.zima@nic.cz>2019-06-17 13:36:16 +0200
commit68e07736e8ad2122e232258f9d0f067f6f74796a (patch)
tree1bd91560c6be9993ecf4a7230632ae27f7706325
parent1f4bfe9a75c029b54fc37d0cf3c546673b45bd5b (diff)
parentf6719a7fa179481df547757ec20acc322d6c60c4 (diff)
downloadopenid-68e07736e8ad2122e232258f9d0f067f6f74796a.tar.gz
Merge branch 'fix-assoc-type-bytes'
-rw-r--r--openid/association.py4
-rw-r--r--openid/test/test_association.py6
2 files changed, 8 insertions, 2 deletions
diff --git a/openid/association.py b/openid/association.py
index f29a4c3..9025ff8 100644
--- a/openid/association.py
+++ b/openid/association.py
@@ -327,6 +327,7 @@ class Association(object):
defined in the future.
@type assoc_type: six.text_type, six.binary_type is deprecated
"""
+ assoc_type = string_to_text(assoc_type, "Binary values for assoc_type are deprecated. Use text input instead.")
if assoc_type not in all_association_types:
fmt = '%r is not a supported association type'
raise ValueError(fmt % (assoc_type,))
@@ -341,8 +342,7 @@ class Association(object):
self.secret = secret
self.issued = issued
self.lifetime = lifetime
- self.assoc_type = string_to_text(assoc_type,
- "Binary values for assoc_type are deprecated. Use text input instead.")
+ self.assoc_type = assoc_type
def getExpiresIn(self, now=None):
"""
diff --git a/openid/test/test_association.py b/openid/test/test_association.py
index 0763b12..7a6b2ea 100644
--- a/openid/test/test_association.py
+++ b/openid/test/test_association.py
@@ -11,6 +11,12 @@ from openid.message import BARE_NS, OPENID2_NS, OPENID_NS, Message
from openid.server.server import DiffieHellmanSHA1ServerSession, PlainTextServerSession
+class TestAssociation(unittest.TestCase):
+ def test_assoc_type_bytes(self):
+ assoc = association.Association('handle', b'secret', 1000, 1000, b'HMAC-SHA1')
+ self.assertEqual(assoc.assoc_type, 'HMAC-SHA1')
+
+
class AssociationSerializationTest(unittest.TestCase):
def test_roundTrip(self):
issued = int(time.time())