forked from p34709852/monkey
UT: Replace call_args comparison with assert_called_with in test_ping_scanner
This commit is contained in:
parent
2ab86fa428
commit
66e8032ef3
|
@ -128,7 +128,7 @@ def test_linux_ping_success(patch_subprocess_running_ping_with_ping_output, mock
|
||||||
assert result.response_received
|
assert result.response_received
|
||||||
assert result.os == OperatingSystem.LINUX
|
assert result.os == OperatingSystem.LINUX
|
||||||
assert mock_agent_event_queue.publish.call_count == 1
|
assert mock_agent_event_queue.publish.call_count == 1
|
||||||
assert mock_agent_event_queue.publish.call_args[0][0] == event
|
mock_agent_event_queue.publish.assert_called_with(event)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.usefixtures("set_os_linux")
|
@pytest.mark.usefixtures("set_os_linux")
|
||||||
|
@ -142,7 +142,7 @@ def test_linux_ping_no_response(
|
||||||
assert not result.response_received
|
assert not result.response_received
|
||||||
assert result.os is None
|
assert result.os is None
|
||||||
assert mock_agent_event_queue.publish.call_count == 1
|
assert mock_agent_event_queue.publish.call_count == 1
|
||||||
assert mock_agent_event_queue.publish.call_args[0][0] == event
|
mock_agent_event_queue.publish.assert_called_with(event)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.usefixtures("set_os_windows")
|
@pytest.mark.usefixtures("set_os_windows")
|
||||||
|
@ -156,7 +156,7 @@ def test_windows_ping_success(
|
||||||
assert result.response_received
|
assert result.response_received
|
||||||
assert result.os == OperatingSystem.WINDOWS
|
assert result.os == OperatingSystem.WINDOWS
|
||||||
assert mock_agent_event_queue.publish.call_count == 1
|
assert mock_agent_event_queue.publish.call_count == 1
|
||||||
assert mock_agent_event_queue.publish.call_args[0][0] == event
|
mock_agent_event_queue.publish.assert_called_with(event)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.usefixtures("set_os_windows")
|
@pytest.mark.usefixtures("set_os_windows")
|
||||||
|
@ -170,7 +170,7 @@ def test_windows_ping_no_response(
|
||||||
assert not result.response_received
|
assert not result.response_received
|
||||||
assert result.os is None
|
assert result.os is None
|
||||||
assert mock_agent_event_queue.publish.call_count == 1
|
assert mock_agent_event_queue.publish.call_count == 1
|
||||||
assert mock_agent_event_queue.publish.call_args[0][0] == event
|
mock_agent_event_queue.publish.assert_called_with(event)
|
||||||
|
|
||||||
|
|
||||||
def test_malformed_ping_command_response(
|
def test_malformed_ping_command_response(
|
||||||
|
@ -183,7 +183,7 @@ def test_malformed_ping_command_response(
|
||||||
assert not result.response_received
|
assert not result.response_received
|
||||||
assert result.os is None
|
assert result.os is None
|
||||||
assert mock_agent_event_queue.publish.call_count == 1
|
assert mock_agent_event_queue.publish.call_count == 1
|
||||||
assert mock_agent_event_queue.publish.call_args[0][0] == event
|
mock_agent_event_queue.publish.assert_called_with(event)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.usefixtures("patch_subprocess_running_ping_to_raise_timeout_expired")
|
@pytest.mark.usefixtures("patch_subprocess_running_ping_to_raise_timeout_expired")
|
||||||
|
@ -194,7 +194,7 @@ def test_timeout_expired(mock_agent_event_queue):
|
||||||
assert not result.response_received
|
assert not result.response_received
|
||||||
assert result.os is None
|
assert result.os is None
|
||||||
assert mock_agent_event_queue.publish.call_count == 1
|
assert mock_agent_event_queue.publish.call_count == 1
|
||||||
assert mock_agent_event_queue.publish.call_args[0][0] == event
|
mock_agent_event_queue.publish.assert_called_with(event)
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
|
|
Loading…
Reference in New Issue