UT: Use new Credentials object in test_credential_telem_send()

This commit is contained in:
Mike Salvatore 2022-07-14 13:11:45 -04:00
parent 2b245b34cb
commit 04d72c0d36
1 changed files with 4 additions and 13 deletions

View File

@ -2,7 +2,7 @@ import json
import pytest
from common.credentials import Credentials, Password, SSHKeypair, Username
from common.credentials import Credentials, Password, Username
from infection_monkey.telemetry.credentials_telem import CredentialsTelem
USERNAME = "m0nkey"
@ -14,24 +14,15 @@ PRIVATE_KEY = "priv_key"
@pytest.fixture
def credentials_for_test():
return Credentials(
[Username(USERNAME)], [Password(PASSWORD), SSHKeypair(PRIVATE_KEY, PUBLIC_KEY)]
)
return Credentials(Username(USERNAME), Password(PASSWORD))
def test_credential_telem_send(spy_send_telemetry, credentials_for_test):
expected_data = [
{
"identities": [{"username": USERNAME, "credential_type": "USERNAME"}],
"secrets": [
{"password": PASSWORD, "credential_type": "PASSWORD"},
{
"private_key": PRIVATE_KEY,
"public_key": PUBLIC_KEY,
"credential_type": "SSH_KEYPAIR",
},
],
"identity": {"username": USERNAME, "credential_type": "USERNAME"},
"secret": {"password": PASSWORD, "credential_type": "PASSWORD"},
}
]