From d1fc4fa7f42f7e86e5f8fd6b5077b6b834b56477 Mon Sep 17 00:00:00 2001 From: Ilija Lazoroski Date: Fri, 23 Sep 2022 15:49:41 +0200 Subject: [PATCH] UT: Parametrize HTTPIslandAPIClient get_agent_signals test --- .../island_api_client/test_http_island_api_client.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/monkey/tests/unit_tests/infection_monkey/island_api_client/test_http_island_api_client.py b/monkey/tests/unit_tests/infection_monkey/island_api_client/test_http_island_api_client.py index 376425696..9505e6649 100644 --- a/monkey/tests/unit_tests/infection_monkey/island_api_client/test_http_island_api_client.py +++ b/monkey/tests/unit_tests/infection_monkey/island_api_client/test_http_island_api_client.py @@ -456,15 +456,16 @@ def test_island_api_client_get_agent_signals__status_code( island_api_client.get_agent_signals(agent_id=AGENT_ID) -def test_island_api_client_get_agent_signals(island_api_client): +@pytest.mark.parametrize("expected_timestamp", [TIMESTAMP, None]) +def test_island_api_client_get_agent_signals(island_api_client, expected_timestamp): with requests_mock.Mocker() as m: m.get(ISLAND_URI) island_api_client.connect(SERVER) - m.get(ISLAND_GET_AGENT_SIGNALS, json={"terminate": TIMESTAMP}) + m.get(ISLAND_GET_AGENT_SIGNALS, json={"terminate": expected_timestamp}) actual_terminate_timestamp = island_api_client.get_agent_signals(agent_id=AGENT_ID) - assert actual_terminate_timestamp == TIMESTAMP + assert actual_terminate_timestamp == expected_timestamp def test_island_api_client_get_agent_signals__bad_json(island_api_client):