blob: c65286960ca0522f77a7dee5a14581a127edab83 [file] [log] [blame]
Terry Chia4756fa92015-10-03 12:23:07 +08001# This file is dual licensed under the terms of the Apache License, Version
2# 2.0, and the BSD License. See the LICENSE file in the root of this repository
3# for complete details.
4
Terry Chia36a787f2015-09-30 19:13:14 +08005from hypothesis import given
Terry Chia3d7f8d12015-09-27 21:00:58 +08006from hypothesis.strategies import binary
Terry Chia42ea0d12015-09-27 20:26:09 +08007
Terry Chiacc2a8282015-03-22 12:06:45 +08008from cryptography.fernet import Fernet
9
Terry Chia42ea0d12015-09-27 20:26:09 +080010
Terry Chia36a787f2015-09-30 19:13:14 +080011@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