mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-23 00:41:35 -05:00
Extracted serialiser for encryption into a flask module
- allows mocking easier - shared across methods - not built everytime
This commit is contained in:
20
tests/app/test_encryption.py
Normal file
20
tests/app/test_encryption.py
Normal file
@@ -0,0 +1,20 @@
|
||||
from app.encryption import Encryption
|
||||
|
||||
encryption = Encryption()
|
||||
|
||||
|
||||
def test_should_encrypt_content(notify_api):
|
||||
encryption.init_app(notify_api)
|
||||
assert encryption.encrypt("this") != "this"
|
||||
|
||||
|
||||
def test_should_decrypt_content(notify_api):
|
||||
encryption.init_app(notify_api)
|
||||
encrypted = encryption.encrypt("this")
|
||||
assert encryption.decrypt(encrypted) == "this"
|
||||
|
||||
|
||||
def test_should_encrypt_json(notify_api):
|
||||
encryption.init_app(notify_api)
|
||||
encrypted = encryption.encrypt({"this": "that"})
|
||||
assert encryption.decrypt(encrypted) == {"this": "that"}
|
||||
Reference in New Issue
Block a user