Terry Chia | cc2a828 | 2015-03-22 12:06:45 +0800 | [diff] [blame] | 1 | import pytest |
2 | |||||
3 | from cryptography.fernet import Fernet | ||||
4 | |||||
5 | hypothesis = pytest.importorskip("hypothesis") | ||||
6 | |||||
7 | |||||
8 | @hypothesis.given(bytes) | ||||
9 | def test_fernet(data): | ||||
10 | f = Fernet(Fernet.generate_key()) | ||||
11 | ct = f.encrypt(data) | ||||
12 | assert f.decrypt(ct) == data |