From cc2a828883d03800b3d7a145571796f01f3ed7d9 Mon Sep 17 00:00:00 2001 From: Terry Chia Date: Sun, 22 Mar 2015 12:06:45 +0800 Subject: Add hypothesis test for Fernet. --- tests/test_with_hypothesis.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 tests/test_with_hypothesis.py (limited to 'tests/test_with_hypothesis.py') 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 -- cgit v1.2.3