blob: 1e39b6b16d478557cc67d0e1215915bb2759d2ff [file] [log] [blame]
Terry Chia42ea0d12015-09-27 20:26:09 +08001from hypothesis import binary
2
Terry Chiacc2a8282015-03-22 12:06:45 +08003import pytest
4
5from cryptography.fernet import Fernet
6
Terry Chia42ea0d12015-09-27 20:26:09 +08007
Terry Chiacc2a8282015-03-22 12:06:45 +08008hypothesis = pytest.importorskip("hypothesis")
9
10
Terry Chia42ea0d12015-09-27 20:26:09 +080011@hypothesis.given(binary())
Terry Chiacc2a8282015-03-22 12:06:45 +080012def test_fernet(data):
13 f = Fernet(Fernet.generate_key())
14 ct = f.encrypt(data)
15 assert f.decrypt(ct) == data