diff --git a/monkey/tests/unit_tests/infection_monkey/exploit/test_powershell.py b/monkey/tests/unit_tests/infection_monkey/exploit/test_powershell.py index ef3da4538..9de7f8f54 100644 --- a/monkey/tests/unit_tests/infection_monkey/exploit/test_powershell.py +++ b/monkey/tests/unit_tests/infection_monkey/exploit/test_powershell.py @@ -32,7 +32,7 @@ Config = namedtuple( ) -class TestAuthenticationError(Exception): +class AuthenticationErrorForTests(Exception): pass @@ -49,7 +49,7 @@ def powershell_exploiter(monkeypatch): DROPPER_TARGET_PATH_64, ) - monkeypatch.setattr(powershell, "AuthenticationError", TestAuthenticationError) + monkeypatch.setattr(powershell, "AuthenticationError", AuthenticationErrorForTests) monkeypatch.setattr(powershell, "is_windows_os", lambda: True) # It's regrettable to mock out a private method on the PowerShellExploiter instance object, but # it's necessary to avoid having to deal with the monkeyfs @@ -69,7 +69,7 @@ def test_powershell_disabled(monkeypatch, powershell_exploiter): def test_powershell_http(monkeypatch, powershell_exploiter): def allow_http(_, credentials: Credentials, auth_options: AuthOptions): if not auth_options.ssl: - raise TestAuthenticationError + raise AuthenticationErrorForTests else: raise Exception @@ -84,7 +84,7 @@ def test_powershell_http(monkeypatch, powershell_exploiter): def test_powershell_https(monkeypatch, powershell_exploiter): def allow_https(_, credentials: Credentials, auth_options: AuthOptions): if auth_options.ssl: - raise TestAuthenticationError + raise AuthenticationErrorForTests else: raise Exception @@ -98,7 +98,7 @@ def test_powershell_https(monkeypatch, powershell_exploiter): def test_no_valid_credentials(monkeypatch, powershell_exploiter): - mock_powershell_client = MagicMock(side_effect=TestAuthenticationError) + mock_powershell_client = MagicMock(side_effect=AuthenticationErrorForTests) monkeypatch.setattr(powershell, "PowerShellClient", mock_powershell_client) success = powershell_exploiter.exploit_host() @@ -110,7 +110,7 @@ def authenticate(mock_client): if credentials.username == "user1" and credentials.secret == "pass2": return mock_client else: - raise TestAuthenticationError("Invalid credentials") + raise AuthenticationErrorForTests("Invalid credentials") return inner