1# 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 5from hypothesis import HealthCheck, given, settings 6from hypothesis.strategies import binary 7 8from cryptography.fernet import Fernet 9 10 11@settings(suppress_health_check=[HealthCheck.too_slow], deadline=None) 12@given(binary()) 13def test_fernet(data): 14 f = Fernet(Fernet.generate_key()) 15 ct = f.encrypt(data) 16 assert f.decrypt(ct) == data 17