aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTerry Chia <terrycwk1994@gmail.com>2015-03-22 12:06:45 +0800
committerTerry Chia <terrycwk1994@gmail.com>2015-09-26 22:31:53 +0800
commitcc2a828883d03800b3d7a145571796f01f3ed7d9 (patch)
treeb5d3cfac249591edc8444ae2835db10e8f7955db
parent7f0705ce3280c31934f111e6b4bba91260cf9cb5 (diff)
downloadcryptography-cc2a828883d03800b3d7a145571796f01f3ed7d9.tar.gz
cryptography-cc2a828883d03800b3d7a145571796f01f3ed7d9.tar.bz2
cryptography-cc2a828883d03800b3d7a145571796f01f3ed7d9.zip
Add hypothesis test for Fernet.
-rw-r--r--tests/test_with_hypothesis.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/test_with_hypothesis.py b/tests/test_with_hypothesis.py
new file mode 100644
index 00000000..261a21d6
--- /dev/null
+++ b/tests/test_with_hypothesis.py
@@ -0,0 +1,12 @@
+import pytest
+
+from cryptography.fernet import Fernet
+
+hypothesis = pytest.importorskip("hypothesis")
+
+
+@hypothesis.given(bytes)
+def test_fernet(data):
+ f = Fernet(Fernet.generate_key())
+ ct = f.encrypt(data)
+ assert f.decrypt(ct) == data