From 11aff1f7fe07514fbda8e0c372a58d66c324742d Mon Sep 17 00:00:00 2001 From: Shreya Malviya Date: Tue, 19 Jul 2022 19:04:14 +0530 Subject: [PATCH] UT: Add tests for EncryptionKey32Bytes --- .../encryption/test_encryption_key_types.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 monkey/tests/unit_tests/monkey_island/cc/server_utils/encryption/test_encryption_key_types.py diff --git a/monkey/tests/unit_tests/monkey_island/cc/server_utils/encryption/test_encryption_key_types.py b/monkey/tests/unit_tests/monkey_island/cc/server_utils/encryption/test_encryption_key_types.py new file mode 100644 index 000000000..b4e412722 --- /dev/null +++ b/monkey/tests/unit_tests/monkey_island/cc/server_utils/encryption/test_encryption_key_types.py @@ -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)