forked from p15670423/monkey
UT: Use new Credentials object in test_credential_telem_send()
This commit is contained in:
parent
2b245b34cb
commit
04d72c0d36
|
@ -2,7 +2,7 @@ import json
|
||||||
|
|
||||||
import pytest
|
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
|
from infection_monkey.telemetry.credentials_telem import CredentialsTelem
|
||||||
|
|
||||||
USERNAME = "m0nkey"
|
USERNAME = "m0nkey"
|
||||||
|
@ -14,24 +14,15 @@ PRIVATE_KEY = "priv_key"
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def credentials_for_test():
|
def credentials_for_test():
|
||||||
|
|
||||||
return Credentials(
|
return Credentials(Username(USERNAME), Password(PASSWORD))
|
||||||
[Username(USERNAME)], [Password(PASSWORD), SSHKeypair(PRIVATE_KEY, PUBLIC_KEY)]
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def test_credential_telem_send(spy_send_telemetry, credentials_for_test):
|
def test_credential_telem_send(spy_send_telemetry, credentials_for_test):
|
||||||
|
|
||||||
expected_data = [
|
expected_data = [
|
||||||
{
|
{
|
||||||
"identities": [{"username": USERNAME, "credential_type": "USERNAME"}],
|
"identity": {"username": USERNAME, "credential_type": "USERNAME"},
|
||||||
"secrets": [
|
"secret": {"password": PASSWORD, "credential_type": "PASSWORD"},
|
||||||
{"password": PASSWORD, "credential_type": "PASSWORD"},
|
|
||||||
{
|
|
||||||
"private_key": PRIVATE_KEY,
|
|
||||||
"public_key": PUBLIC_KEY,
|
|
||||||
"credential_type": "SSH_KEYPAIR",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue