blob: 5a1812160e3f6b6ab0c4d66632c67002b9362cb8 [file] [log] [blame]
Terry Chia36a787f2015-09-30 19:13:14 +08001from hypothesis import given
Terry Chia3d7f8d12015-09-27 21:00:58 +08002from hypothesis.strategies import binary
Terry Chia42ea0d12015-09-27 20:26:09 +08003
Terry Chiacc2a8282015-03-22 12:06:45 +08004import pytest
5
6from cryptography.fernet import Fernet
7
Terry Chia42ea0d12015-09-27 20:26:09 +08008
Terry Chiacc2a8282015-03-22 12:06:45 +08009hypothesis = pytest.importorskip("hypothesis")
10
11
Terry Chia36a787f2015-09-30 19:13:14 +080012@given(binary())
Terry Chiacc2a8282015-03-22 12:06:45 +080013def test_fernet(data):
14 f = Fernet(Fernet.generate_key())
15 ct = f.encrypt(data)
16 assert f.decrypt(ct) == data