aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_fernet.py
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2013-10-31 15:23:15 -0700
committerAlex Gaynor <alex.gaynor@gmail.com>2013-10-31 15:23:15 -0700
commitce8f9a4e2a5d159356a06147f65e221dbdf43171 (patch)
tree15576747f0539437673ba44d61c73c2c3f448777 /tests/test_fernet.py
parentc1ea0a0d23115bb0586230a139bcb2b60adb6262 (diff)
downloadcryptography-ce8f9a4e2a5d159356a06147f65e221dbdf43171.tar.gz
cryptography-ce8f9a4e2a5d159356a06147f65e221dbdf43171.tar.bz2
cryptography-ce8f9a4e2a5d159356a06147f65e221dbdf43171.zip
A test for roundtripping
Diffstat (limited to 'tests/test_fernet.py')
-rw-r--r--tests/test_fernet.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/test_fernet.py b/tests/test_fernet.py
index b0f22f0c..a42011a6 100644
--- a/tests/test_fernet.py
+++ b/tests/test_fernet.py
@@ -61,3 +61,10 @@ class TestFernet(object):
f.encrypt(six.u(""))
with pytest.raises(TypeError):
f.decrypt(six.u(""))
+
+ @pytest.mark.parametrize("message", [b"", b"Abc!", b"\x00\xFF\x00\x80"])
+ def test_roundtrips(self, message):
+ f = Fernet(b"\x00" * 32)
+ ciphertext = f.encrypt(message)
+ plaintext = f.decrypt(ciphertext)
+ assert plaintext == message