UT: Mock AbstractAgentEvent's timestamp (time.time()) in test_tcp_scanner.py

This commit is contained in:
Shreya Malviya 2022-09-30 17:27:17 +05:30 committed by Ilija Lazoroski
parent 0a11d34fb7
commit 9754b4731c
1 changed files with 12 additions and 0 deletions

View File

@ -1,3 +1,4 @@
import time
from unittest.mock import MagicMock
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"}
TIMESTAMP = 123.321
@pytest.fixture(scope="module")
def patch_timestamp(monkeypatch):
monkeypatch.setattr(
time,
"time",
TIMESTAMP,
)
@pytest.fixture
def patch_check_tcp_ports(monkeypatch, open_ports_data):