forked from p15670423/monkey
Island: Remove disused StringEncryptor
This commit is contained in:
parent
86ce7f2cf9
commit
9639acffa5
|
@ -15,4 +15,3 @@ from .data_store_encryptor import (
|
|||
reset_datastore_encryptor,
|
||||
)
|
||||
from .field_encryptors.i_field_encryptor import IFieldEncryptor
|
||||
from .field_encryptors.string_encryptor import StringEncryptor
|
||||
|
|
|
@ -1,2 +1 @@
|
|||
from .i_field_encryptor import IFieldEncryptor
|
||||
from .string_encryptor import StringEncryptor
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
from ..data_store_encryptor import get_datastore_encryptor
|
||||
from . import IFieldEncryptor
|
||||
|
||||
|
||||
class StringEncryptor(IFieldEncryptor):
|
||||
@staticmethod
|
||||
def encrypt(value: str):
|
||||
return get_datastore_encryptor().encrypt(value.encode())
|
||||
|
||||
@staticmethod
|
||||
def decrypt(value: str):
|
||||
return get_datastore_encryptor().decrypt(value).decode()
|
|
@ -1,17 +0,0 @@
|
|||
from monkey_island.cc.server_utils.encryption import StringEncryptor
|
||||
|
||||
MOCK_STRING = "m0nk3y"
|
||||
EMPTY_STRING = ""
|
||||
|
||||
|
||||
def test_encryptor(uses_encryptor):
|
||||
encrypted_string = StringEncryptor.encrypt(MOCK_STRING)
|
||||
assert not encrypted_string == MOCK_STRING
|
||||
decrypted_string = StringEncryptor.decrypt(encrypted_string)
|
||||
assert decrypted_string == MOCK_STRING
|
||||
|
||||
|
||||
def test_empty_string(uses_encryptor):
|
||||
# Tests that no erros are raised
|
||||
encrypted_string = StringEncryptor.encrypt(EMPTY_STRING)
|
||||
StringEncryptor.decrypt(encrypted_string)
|
Loading…
Reference in New Issue