forked from p15670423/monkey
UT: Mock AbstractAgentEvent's timestamp (time.time()) in test_tcp_scanner.py
This commit is contained in:
parent
0a11d34fb7
commit
9754b4731c
|
@ -1,3 +1,4 @@
|
||||||
|
import time
|
||||||
from unittest.mock import MagicMock
|
from unittest.mock import MagicMock
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
@ -13,6 +14,17 @@ PORTS_TO_SCAN = [22, 80, 8080, 143, 445, 2222]
|
||||||
|
|
||||||
OPEN_PORTS_DATA = {22: "SSH-banner", 80: "", 2222: "SSH2-banner"}
|
OPEN_PORTS_DATA = {22: "SSH-banner", 80: "", 2222: "SSH2-banner"}
|
||||||
|
|
||||||
|
TIMESTAMP = 123.321
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture(scope="module")
|
||||||
|
def patch_timestamp(monkeypatch):
|
||||||
|
monkeypatch.setattr(
|
||||||
|
time,
|
||||||
|
"time",
|
||||||
|
TIMESTAMP,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def patch_check_tcp_ports(monkeypatch, open_ports_data):
|
def patch_check_tcp_ports(monkeypatch, open_ports_data):
|
||||||
|
|
Loading…
Reference in New Issue