diff options
author | Alex Gaynor <alex.gaynor@gmail.com> | 2013-10-31 15:23:15 -0700 |
---|---|---|
committer | Alex Gaynor <alex.gaynor@gmail.com> | 2013-10-31 15:23:15 -0700 |
commit | ce8f9a4e2a5d159356a06147f65e221dbdf43171 (patch) | |
tree | 15576747f0539437673ba44d61c73c2c3f448777 | |
parent | c1ea0a0d23115bb0586230a139bcb2b60adb6262 (diff) | |
download | cryptography-ce8f9a4e2a5d159356a06147f65e221dbdf43171.tar.gz cryptography-ce8f9a4e2a5d159356a06147f65e221dbdf43171.tar.bz2 cryptography-ce8f9a4e2a5d159356a06147f65e221dbdf43171.zip |
A test for roundtripping
-rw-r--r-- | tests/test_fernet.py | 7 |
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 |