aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_fernet.py
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2013-12-20 11:02:33 -0800
committerAlex Gaynor <alex.gaynor@gmail.com>2013-12-20 11:02:33 -0800
commite78960fa8c2a210484695bf2e20c4847313cf5a0 (patch)
treecd5760d1da82cac45de7c5ac8e21164d1e92ee04 /tests/test_fernet.py
parent05515723738870170b05b47ee260564b9ebe62f9 (diff)
downloadcryptography-e78960fa8c2a210484695bf2e20c4847313cf5a0.tar.gz
cryptography-e78960fa8c2a210484695bf2e20c4847313cf5a0.tar.bz2
cryptography-e78960fa8c2a210484695bf2e20c4847313cf5a0.zip
Handle invalid timestamp length
Diffstat (limited to 'tests/test_fernet.py')
-rw-r--r--tests/test_fernet.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/test_fernet.py b/tests/test_fernet.py
index 77661180..45188c47 100644
--- a/tests/test_fernet.py
+++ b/tests/test_fernet.py
@@ -74,6 +74,11 @@ class TestFernet(object):
with pytest.raises(InvalidToken):
f.decrypt(base64.urlsafe_b64encode(b"\x81"))
+ def test_timestamp_too_short(self, backend):
+ f = Fernet(Fernet.generate_key(), backend=backend)
+ with pytest.raises(InvalidToken):
+ f.decrypt(base64.urlsafe_b64encode(b"\x80abc"))
+
def test_unicode(self, backend):
f = Fernet(base64.urlsafe_b64encode(b"\x00" * 32), backend=backend)
with pytest.raises(TypeError):