UT: Fix some of powershell UT's

This commit is contained in:
vakaris_zilius 2022-09-06 14:30:41 +00:00
parent ece4d9383e
commit dc8e644bc5
1 changed files with 7 additions and 6 deletions

View File

@ -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)