From 82ce091063c50fe3df2d98239f9f0b2b52e45fa0 Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Wed, 6 Jul 2022 19:32:18 -0400 Subject: [PATCH] Common: Export InvalidCredentialComponent from common.credentials --- monkey/common/credentials/__init__.py | 6 +++++- .../tests/unit_tests/common/credentials/test_ntlm_hash.py | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/monkey/common/credentials/__init__.py b/monkey/common/credentials/__init__.py index 92a778886..f49f6af03 100644 --- a/monkey/common/credentials/__init__.py +++ b/monkey/common/credentials/__init__.py @@ -1,8 +1,12 @@ from .credential_component_type import CredentialComponentType from .i_credential_component import ICredentialComponent -from .credentials import Credentials + +from .validators import InvalidCredentialComponent + from .lm_hash import LMHash from .nt_hash import NTHash from .password import Password from .ssh_keypair import SSHKeypair from .username import Username + +from .credentials import Credentials diff --git a/monkey/tests/unit_tests/common/credentials/test_ntlm_hash.py b/monkey/tests/unit_tests/common/credentials/test_ntlm_hash.py index ee41a2318..28f7bcaae 100644 --- a/monkey/tests/unit_tests/common/credentials/test_ntlm_hash.py +++ b/monkey/tests/unit_tests/common/credentials/test_ntlm_hash.py @@ -1,6 +1,6 @@ import pytest -from common.credentials import LMHash, NTHash +from common.credentials import InvalidCredentialComponent, LMHash, NTHash VALID_HASH = "E520AC67419A9A224A3B108F3FA6CB6D" INVALID_HASHES = ( @@ -22,5 +22,5 @@ def test_construct_valid_ntlm_hash(ntlm_hash_class): @pytest.mark.parametrize("ntlm_hash_class", (LMHash, NTHash)) def test_construct_invalid_ntlm_hash(ntlm_hash_class): for invalid_hash in INVALID_HASHES: - with pytest.raises(Exception): + with pytest.raises(InvalidCredentialComponent): ntlm_hash_class(invalid_hash)