From dc8e644bc5140720645b0130bbba600691f3925a Mon Sep 17 00:00:00 2001 From: vakaris_zilius Date: Tue, 6 Sep 2022 14:30:41 +0000 Subject: [PATCH] UT: Fix some of powershell UT's --- .../powershell_utils/test_powershell_client.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/monkey/tests/unit_tests/infection_monkey/exploit/powershell_utils/test_powershell_client.py b/monkey/tests/unit_tests/infection_monkey/exploit/powershell_utils/test_powershell_client.py index 73f7ea64c..2d6d1788f 100644 --- a/monkey/tests/unit_tests/infection_monkey/exploit/powershell_utils/test_powershell_client.py +++ b/monkey/tests/unit_tests/infection_monkey/exploit/powershell_utils/test_powershell_client.py @@ -1,4 +1,5 @@ import pytest +from pydantic import SecretStr from infection_monkey.exploit.powershell_utils.credentials import Credentials, SecretType from infection_monkey.exploit.powershell_utils.powershell_client import format_password @@ -14,17 +15,17 @@ def test_format_cached_credentials(): def test_format_password(): - expected = "test_password" + expected = SecretStr("test_password") creds = Credentials("test_user", expected, SecretType.PASSWORD) actual = format_password(creds) - assert expected == actual + assert expected.get_secret_value() == actual def test_format_lm_hash(): - lm_hash = "c080132b6f2a0c4e5d1029cc06f48a92" - expected = f"{lm_hash}:00000000000000000000000000000000" + lm_hash = SecretStr("c080132b6f2a0c4e5d1029cc06f48a92") + expected = f"{lm_hash.get_secret_value()}:00000000000000000000000000000000" creds = Credentials("test_user", lm_hash, SecretType.LM_HASH) @@ -34,8 +35,8 @@ def test_format_lm_hash(): def test_format_nt_hash(): - nt_hash = "c080132b6f2a0c4e5d1029cc06f48a92" - expected = f"00000000000000000000000000000000:{nt_hash}" + nt_hash = SecretStr("c080132b6f2a0c4e5d1029cc06f48a92") + expected = f"00000000000000000000000000000000:{nt_hash.get_secret_value()}" creds = Credentials("test_user", nt_hash, SecretType.NT_HASH)