From f78cb24150ec8bac8f0be0970874df7e1836e850 Mon Sep 17 00:00:00 2001 From: Charlie Crane Date: Mon, 29 Jul 2024 14:20:29 +0100 Subject: [PATCH] #2706 - Removed some un-necessary comments and changes to network used in terminal ACL unit test --- .../simulator/system/services/terminal/terminal.py | 6 ------ .../_simulator/_system/_services/test_terminal.py | 11 +++++++++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/primaite/simulator/system/services/terminal/terminal.py b/src/primaite/simulator/system/services/terminal/terminal.py index cadc8853..3caf57be 100644 --- a/src/primaite/simulator/system/services/terminal/terminal.py +++ b/src/primaite/simulator/system/services/terminal/terminal.py @@ -72,8 +72,6 @@ class Terminal(Service): kwargs["protocol"] = IPProtocol.TCP super().__init__(**kwargs) - # %% Util - def describe_state(self) -> Dict: """ Produce a dictionary describing the current state of this object. @@ -182,8 +180,6 @@ class Terminal(Service): """Message that is reported when a request is rejected by this validator.""" return "Cannot perform request on terminal as not logged in." - # %% Inbound - def login(self, username: str, password: str, ip_address: Optional[IPv4Address] = None) -> bool: """Process User request to login to Terminal. @@ -310,8 +306,6 @@ class Terminal(Service): return True - # %% Outbound - def execute(self, command: List[Any]) -> bool: """Execute a passed ssh command via the request manager.""" # TODO: Expand as necessary, as new functionalilty is needed. diff --git a/tests/unit_tests/_primaite/_simulator/_system/_services/test_terminal.py b/tests/unit_tests/_primaite/_simulator/_system/_services/test_terminal.py index 17af5699..e1241bbe 100644 --- a/tests/unit_tests/_primaite/_simulator/_system/_services/test_terminal.py +++ b/tests/unit_tests/_primaite/_simulator/_system/_services/test_terminal.py @@ -17,7 +17,6 @@ from primaite.simulator.system.services.dns.dns_server import DNSServer from primaite.simulator.system.services.service import ServiceOperatingState from primaite.simulator.system.services.terminal.terminal import Terminal from primaite.simulator.system.services.web_server.web_server import WebServer -from primaite.simulator.system.software import SoftwareHealthState @pytest.fixture(scope="function") @@ -194,6 +193,14 @@ def test_network_simulation(basic_network): endpoint_b=switch_1.network_interface[1], ) + client_2 = Computer( + hostname="client_2", + ip_address="10.0.2.2", + subnet_mask="255.255.255.0", + ) + client_2.power_on() + network.connect(endpoint_a=client_2.network_interface[1], endpoint_b=switch_2.network_interface[1]) + # 1.4: Create and connect servers server_1 = Server( hostname="server_1", @@ -233,7 +240,7 @@ def test_network_simulation(basic_network): terminal_1: Terminal = client_1.software_manager.software.get("Terminal") - assert terminal_1.login(username="admin", password="Admin123!", ip_address="192.168.0.11") is False + assert terminal_1.login(username="admin", password="Admin123!", ip_address="10.0.2.2") is False def test_terminal_receives_requests(game_and_agent_fixture: Tuple[PrimaiteGame, ProxyAgent]):