UT: Add tests for EncryptionKey32Bytes

This commit is contained in:
Shreya Malviya 2022-07-19 19:04:14 +05:30
parent 6000fdcaf1
commit 11aff1f7fe
1 changed files with 15 additions and 0 deletions

View File

@ -0,0 +1,15 @@
import pytest
from monkey_island.cc.server_utils.encryption.encryption_key_types import EncryptionKey32Bytes
@pytest.mark.parametrize("key", ["", 2, []])
def test_create_encryption_key_32_bytes__raises_type_error(key):
with pytest.raises(TypeError):
EncryptionKey32Bytes(key)
@pytest.mark.parametrize("key", [b"", b"less", b"this is something that is longer than 32"])
def test_create_encryption_key_32_bytes__raises_value_error(key):
with pytest.raises(ValueError):
EncryptionKey32Bytes(key)