UT: Make string ports to be integers

Pydantic converts strings to integer but if we enter
integers is safer.
This commit is contained in:
Ilija Lazoroski 2022-09-29 18:13:14 +02:00 committed by Mike Salvatore
parent 17017d6962
commit 725c6d9419
4 changed files with 5 additions and 5 deletions

View File

@ -21,7 +21,7 @@ from infection_monkey.island_api_client import (
IslandAPITimeoutError, IslandAPITimeoutError,
) )
SERVER = SocketAddress(ip="1.1.1.1", port="9999") SERVER = SocketAddress(ip="1.1.1.1", port=9999)
PBA_FILE = "dummy.pba" PBA_FILE = "dummy.pba"
WINDOWS = "windows" WINDOWS = "windows"
AGENT_ID = UUID("80988359-a1cd-42a2-9b47-5b94b37cd673") AGENT_ID = UUID("80988359-a1cd-42a2-9b47-5b94b37cd673")

View File

@ -114,7 +114,7 @@ def test_existing_machine_updated__find_by_ip(handler, machine_repository):
machine_hardware_id=5, machine_hardware_id=5,
start_time=0, start_time=0,
parent_id=None, parent_id=None,
cc_server=SocketAddress(ip="192.168.1.1", port="5000"), cc_server=SocketAddress(ip="192.168.1.1", port=5000),
network_interfaces=[ network_interfaces=[
IPv4Interface("192.168.1.2/24"), IPv4Interface("192.168.1.2/24"),
IPv4Interface("192.168.1.4/24"), IPv4Interface("192.168.1.4/24"),
@ -218,7 +218,7 @@ def test_machine_interfaces_updated(handler, machine_repository):
machine_hardware_id=MACHINE.hardware_id, machine_hardware_id=MACHINE.hardware_id,
start_time=0, start_time=0,
parent_id=None, parent_id=None,
cc_server=SocketAddress(ip="192.168.1.1", port="5000"), cc_server=SocketAddress(ip="192.168.1.1", port=5000),
network_interfaces=[ network_interfaces=[
IPv4Interface("192.168.1.2/24"), IPv4Interface("192.168.1.2/24"),
IPv4Interface("192.168.1.3/16"), IPv4Interface("192.168.1.3/16"),

View File

@ -10,7 +10,7 @@ from common.types import SocketAddress
AGENT_ID = UUID("012e7238-7b81-4108-8c7f-0787bc3f3c10") AGENT_ID = UUID("012e7238-7b81-4108-8c7f-0787bc3f3c10")
PARENT_ID = UUID("0fc9afcb-1902-436b-bd5c-1ad194252484") PARENT_ID = UUID("0fc9afcb-1902-436b-bd5c-1ad194252484")
SOCKET_ADDRESS = SocketAddress(ip="192.168.1.1", port="5000") SOCKET_ADDRESS = SocketAddress(ip="192.168.1.1", port=5000)
AGENT_REGISTRATION_MESSAGE_OBJECT_DICT = { AGENT_REGISTRATION_MESSAGE_OBJECT_DICT = {
"id": AGENT_ID, "id": AGENT_ID,

View File

@ -55,7 +55,7 @@ AGENTS = (
*RUNNING_AGENTS, *RUNNING_AGENTS,
*STOPPED_AGENTS, *STOPPED_AGENTS,
) )
CC_SERVER = SocketAddress(ip="127.0.0.1", port="1984") CC_SERVER = SocketAddress(ip="127.0.0.1", port=1984)
@pytest.fixture @pytest.fixture