30 lines
688 B
Python
30 lines
688 B
Python
import pytest
|
|
|
|
from pyinfra.utils.cipher import decrypt, encrypt
|
|
|
|
|
|
@pytest.fixture
|
|
def ciphertext():
|
|
return "AAAADBRzag4/aAE2+rSekyI5phVZ1e0wwSaRkGQTLftPyVvq8vLYZzwxW48Wozc3/w=="
|
|
|
|
|
|
@pytest.fixture
|
|
def plaintext():
|
|
return "connectzionString"
|
|
|
|
|
|
@pytest.fixture
|
|
def public_key():
|
|
return "redaction"
|
|
|
|
|
|
class TestDecryption:
|
|
def test_decrypt_ciphertext(self, public_key, ciphertext, plaintext):
|
|
result = decrypt(public_key, ciphertext)
|
|
assert result == plaintext
|
|
|
|
def test_encrypt_plaintext(self, public_key, plaintext):
|
|
ciphertext = encrypt(public_key, plaintext)
|
|
result = decrypt(public_key, ciphertext)
|
|
assert plaintext == result
|