Skip to content

Commit

Permalink
Fix frontpage example
Browse files Browse the repository at this point in the history
Fix #29
  • Loading branch information
untitaker committed Aug 21, 2016
1 parent 0f6d5c5 commit 9c4f63c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
4 changes: 3 additions & 1 deletion itsdangerous.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,9 @@ def get_signature(self, value):

def sign(self, value):
"""Signs the given string."""
return value + want_bytes(self.sep) + self.get_signature(value)
return want_bytes(value) + \
want_bytes(self.sep) + \
self.get_signature(value)

def verify_signature(self, value, sig):
"""Verifies the signature for the given value."""
Expand Down
10 changes: 10 additions & 0 deletions tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@ def test_want_bytes(self):
self.assertEqual(want_bytes(u"foobar"), b"foobar")


class SignerTestCase(unittest.TestCase):
signer_class = idmod.Signer
def make_signer(self, *args, **kwargs):
return self.signer_class(*args, **kwargs)

def test_sign(self):
s = self.make_signer('secret-key')
assert isinstance(s.sign('my string'), bytes)


class SerializerTestCase(unittest.TestCase):
serializer_class = idmod.Serializer

Expand Down

0 comments on commit 9c4f63c

Please sign in to comment.