#2735 - tidies up some oif the api, temporarily integrated login checks to ping for testing, added temp test

This commit is contained in:
Chris McCarthy
2024-07-19 10:34:32 +01:00
parent 93350ecd30
commit 8702dc7067
7 changed files with 391 additions and 300 deletions

View File

@@ -0,0 +1,37 @@
# © Crown-owned copyright 2024, Defence Science and Technology Laboratory UK
from primaite.simulator.network.container import Network
from primaite.simulator.network.hardware.nodes.host.computer import Computer
from primaite.simulator.network.hardware.nodes.host.server import Server
def test_local_accounts_ping_temp():
network = Network()
# Create Computer
computer = Computer(
hostname="computer",
ip_address="192.168.1.2",
subnet_mask="255.255.255.0",
default_gateway="192.168.1.1",
start_up_duration=0,
)
computer.power_on()
# Create Server
server = Server(
hostname="server",
ip_address="192.168.1.3",
subnet_mask="255.255.255.0",
default_gateway="192.168.1.1",
start_up_duration=0,
)
server.power_on()
# Connect Computer and Server
network.connect(computer.network_interface[1], server.network_interface[1])
assert not computer.ping(server.network_interface[1].ip_address)
computer.user_session_manager.login(username="admin", password="admin")
assert computer.ping(server.network_interface[1].ip_address)