blob: 31dfa04c589af5bb96101a121be86a39fc7fd267 [file] [log] [blame]
Terry Chia3d7f8d12015-09-27 21:00:58 +08001from hypothesis.strategies import binary
Terry Chia42ea0d12015-09-27 20:26:09 +08002
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