#2706 - Removed some un-necessary comments and changes to network used in terminal ACL unit test

This commit is contained in:
Charlie Crane
2024-07-29 14:20:29 +01:00
parent 586e3f6389
commit f78cb24150
2 changed files with 9 additions and 8 deletions

View File

@@ -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.

View File

@@ -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]):