2016-02-16 15:28:30 +00:00
|
|
|
from app.encryption import Encryption
|
|
|
|
|
|
|
|
|
|
encryption = Encryption()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_should_encrypt_content(notify_api):
|
2019-01-31 15:08:23 +00:00
|
|
|
encryption.init_app(notify_api)
|
|
|
|
|
assert encryption.encrypt("this") != "this"
|
2016-02-16 15:28:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_should_decrypt_content(notify_api):
|
2019-01-31 15:08:23 +00:00
|
|
|
encryption.init_app(notify_api)
|
|
|
|
|
encrypted = encryption.encrypt("this")
|
|
|
|
|
assert encryption.decrypt(encrypted) == "this"
|
2016-02-16 15:28:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_should_encrypt_json(notify_api):
|
2019-01-31 15:08:23 +00:00
|
|
|
encryption.init_app(notify_api)
|
|
|
|
|
encrypted = encryption.encrypt({"this": "that"})
|
|
|
|
|
assert encryption.decrypt(encrypted) == {"this": "that"}
|