#3062 - First pass at unifying naming convention for discriminators (still errors) [skip ci]
This commit is contained in:
@@ -99,7 +99,7 @@ def test_web_browser_install():
|
||||
game = load_config(BASIC_CONFIG)
|
||||
client_1: Computer = game.simulation.network.get_node_by_hostname("client_1")
|
||||
|
||||
web_browser: WebBrowser = client_1.software_manager.software.get("WebBrowser")
|
||||
web_browser: WebBrowser = client_1.software_manager.software.get("web-browser")
|
||||
|
||||
assert web_browser.target_url == "http://arcd.com/users/"
|
||||
|
||||
@@ -109,7 +109,7 @@ def test_database_client_install():
|
||||
game = load_config(BASIC_CONFIG)
|
||||
client_1: Computer = game.simulation.network.get_node_by_hostname("client_1")
|
||||
|
||||
database_client: DatabaseClient = client_1.software_manager.software.get("DatabaseClient")
|
||||
database_client: DatabaseClient = client_1.software_manager.software.get("database-client")
|
||||
|
||||
assert database_client.server_ip_address == IPv4Address("192.168.1.10")
|
||||
assert database_client.server_password == "arcd"
|
||||
@@ -120,7 +120,7 @@ def test_data_manipulation_bot_install():
|
||||
game = load_config(BASIC_CONFIG)
|
||||
client_1: Computer = game.simulation.network.get_node_by_hostname("client_1")
|
||||
|
||||
data_manipulation_bot: DataManipulationBot = client_1.software_manager.software.get("DataManipulationBot")
|
||||
data_manipulation_bot: DataManipulationBot = client_1.software_manager.software.get("data-manipulation-bot")
|
||||
|
||||
assert data_manipulation_bot.server_ip_address == IPv4Address("192.168.1.21")
|
||||
assert data_manipulation_bot.payload == "DELETE"
|
||||
@@ -134,7 +134,7 @@ def test_dos_bot_install():
|
||||
game = load_config(BASIC_CONFIG)
|
||||
client_1: Computer = game.simulation.network.get_node_by_hostname("client_1")
|
||||
|
||||
dos_bot: DoSBot = client_1.software_manager.software.get("DoSBot")
|
||||
dos_bot: DoSBot = client_1.software_manager.software.get("dos-bot")
|
||||
|
||||
assert dos_bot.target_ip_address == IPv4Address("192.168.10.21")
|
||||
assert dos_bot.payload == "SPOOF DATA"
|
||||
@@ -149,7 +149,7 @@ def test_dns_client_install():
|
||||
game = load_config(BASIC_CONFIG)
|
||||
client_1: Computer = game.simulation.network.get_node_by_hostname("client_1")
|
||||
|
||||
dns_client: DNSClient = client_1.software_manager.software.get("DNSClient")
|
||||
dns_client: DNSClient = client_1.software_manager.software.get("dns-client")
|
||||
|
||||
assert dns_client.dns_server == IPv4Address("192.168.1.10")
|
||||
|
||||
@@ -159,7 +159,7 @@ def test_dns_server_install():
|
||||
game = load_config(BASIC_CONFIG)
|
||||
client_1: Computer = game.simulation.network.get_node_by_hostname("client_1")
|
||||
|
||||
dns_server: DNSServer = client_1.software_manager.software.get("DNSServer")
|
||||
dns_server: DNSServer = client_1.software_manager.software.get("dns-server")
|
||||
|
||||
assert dns_server.dns_lookup("arcd.com") == IPv4Address("192.168.1.10")
|
||||
|
||||
@@ -169,7 +169,7 @@ def test_database_service_install():
|
||||
game = load_config(BASIC_CONFIG)
|
||||
client_1: Computer = game.simulation.network.get_node_by_hostname("client_1")
|
||||
|
||||
database_service: DatabaseService = client_1.software_manager.software.get("DatabaseService")
|
||||
database_service: DatabaseService = client_1.software_manager.software.get("database-service")
|
||||
|
||||
assert database_service.backup_server_ip == IPv4Address("192.168.1.10")
|
||||
|
||||
@@ -179,10 +179,10 @@ def test_web_server_install():
|
||||
game = load_config(BASIC_CONFIG)
|
||||
client_1: Computer = game.simulation.network.get_node_by_hostname("client_1")
|
||||
|
||||
web_server_service: WebServer = client_1.software_manager.software.get("WebServer")
|
||||
web_server_service: WebServer = client_1.software_manager.software.get("web-server")
|
||||
|
||||
# config should have also installed database client - web server service should be able to retrieve this
|
||||
assert web_server_service.software_manager.software.get("DatabaseClient") is not None
|
||||
assert web_server_service.software_manager.software.get("database-client") is not None
|
||||
|
||||
|
||||
def test_ftp_client_install():
|
||||
@@ -190,7 +190,7 @@ def test_ftp_client_install():
|
||||
game = load_config(BASIC_CONFIG)
|
||||
client_1: Computer = game.simulation.network.get_node_by_hostname("client_1")
|
||||
|
||||
ftp_client_service: FTPClient = client_1.software_manager.software.get("FTPClient")
|
||||
ftp_client_service: FTPClient = client_1.software_manager.software.get("ftp-client")
|
||||
assert ftp_client_service is not None
|
||||
|
||||
|
||||
@@ -199,7 +199,7 @@ def test_ftp_server_install():
|
||||
game = load_config(BASIC_CONFIG)
|
||||
client_1: Computer = game.simulation.network.get_node_by_hostname("client_1")
|
||||
|
||||
ftp_server_service: FTPServer = client_1.software_manager.software.get("FTPServer")
|
||||
ftp_server_service: FTPServer = client_1.software_manager.software.get("ftp-server")
|
||||
assert ftp_server_service is not None
|
||||
|
||||
|
||||
@@ -208,7 +208,7 @@ def test_ntp_client_install():
|
||||
game = load_config(BASIC_CONFIG)
|
||||
client_1: Computer = game.simulation.network.get_node_by_hostname("client_1")
|
||||
|
||||
ntp_client_service: NTPClient = client_1.software_manager.software.get("NTPClient")
|
||||
ntp_client_service: NTPClient = client_1.software_manager.software.get("ntp-client")
|
||||
assert ntp_client_service is not None
|
||||
assert ntp_client_service.ntp_server == IPv4Address("192.168.1.10")
|
||||
|
||||
@@ -218,5 +218,5 @@ def test_ntp_server_install():
|
||||
game = load_config(BASIC_CONFIG)
|
||||
client_1: Computer = game.simulation.network.get_node_by_hostname("client_1")
|
||||
|
||||
ntp_server_service: NTPServer = client_1.software_manager.software.get("NTPServer")
|
||||
ntp_server_service: NTPServer = client_1.software_manager.software.get("ntp-server")
|
||||
assert ntp_server_service is not None
|
||||
|
||||
@@ -16,7 +16,7 @@ from tests import TEST_ASSETS_ROOT
|
||||
TEST_CONFIG = TEST_ASSETS_ROOT / "configs/software_fixing_duration.yaml"
|
||||
ONE_ITEM_CONFIG = TEST_ASSETS_ROOT / "configs/fixing_duration_one_item.yaml"
|
||||
|
||||
TestApplications = ["DummyApplication", "BroadcastTestClient"]
|
||||
TestApplications = ["dummy-application", "broadcast-test-client"]
|
||||
|
||||
|
||||
def load_config(config_path: Union[str, Path]) -> PrimaiteGame:
|
||||
@@ -32,10 +32,10 @@ def test_default_fixing_duration():
|
||||
game = load_config(TEST_CONFIG)
|
||||
client_2: Computer = game.simulation.network.get_node_by_hostname("client_2")
|
||||
|
||||
database_client: DatabaseClient = client_2.software_manager.software.get("DatabaseClient")
|
||||
database_client: DatabaseClient = client_2.software_manager.software.get("database-client")
|
||||
assert database_client.config.fixing_duration == 2
|
||||
|
||||
dns_client: DNSClient = client_2.software_manager.software.get("DNSClient")
|
||||
dns_client: DNSClient = client_2.software_manager.software.get("dns-client")
|
||||
assert dns_client.config.fixing_duration == 2
|
||||
|
||||
|
||||
@@ -45,7 +45,15 @@ def test_fixing_duration_set_from_config():
|
||||
client_1: Computer = game.simulation.network.get_node_by_hostname("client_1")
|
||||
|
||||
# in config - services take 3 timesteps to fix
|
||||
for service in ["DNSClient", "DNSServer", "DatabaseService", "WebServer", "FTPClient", "FTPServer", "NTPServer"]:
|
||||
for service in [
|
||||
"dns-client",
|
||||
"dns-server",
|
||||
"database-service",
|
||||
"web-server",
|
||||
"ftp-client",
|
||||
"ftp-server",
|
||||
"ntp-server",
|
||||
]:
|
||||
assert client_1.software_manager.software.get(service) is not None
|
||||
assert client_1.software_manager.software.get(service).config.fixing_duration == 3
|
||||
|
||||
@@ -53,7 +61,7 @@ def test_fixing_duration_set_from_config():
|
||||
# remove test applications from list
|
||||
applications = set(Application._registry) - set(TestApplications)
|
||||
|
||||
for application in ["RansomwareScript", "WebBrowser", "DataManipulationBot", "DoSBot", "DatabaseClient"]:
|
||||
for application in ["ransomware-script", "web-browser", "data-manipulation-bot", "dos-bot", "database-client"]:
|
||||
assert client_1.software_manager.software.get(application) is not None
|
||||
assert client_1.software_manager.software.get(application).config.fixing_duration == 1
|
||||
|
||||
@@ -64,18 +72,18 @@ def test_fixing_duration_for_one_item():
|
||||
client_1: Computer = game.simulation.network.get_node_by_hostname("client_1")
|
||||
|
||||
# in config - services take 3 timesteps to fix
|
||||
for service in ["DNSClient", "DNSServer", "WebServer", "FTPClient", "FTPServer", "NTPServer"]:
|
||||
for service in ["dns-client", "dns-server", "web-server", "ftp-client", "ftp-server", "ntp-server"]:
|
||||
assert client_1.software_manager.software.get(service) is not None
|
||||
assert client_1.software_manager.software.get(service).config.fixing_duration == 2
|
||||
|
||||
# in config - applications take 1 timestep to fix
|
||||
# remove test applications from list
|
||||
for applications in ["RansomwareScript", "WebBrowser", "DataManipulationBot", "DoSBot"]:
|
||||
for applications in ["ransomware-script", "web-browser", "data-manipulation-bot", "dos-bot"]:
|
||||
assert client_1.software_manager.software.get(applications) is not None
|
||||
assert client_1.software_manager.software.get(applications).config.fixing_duration == 2
|
||||
|
||||
database_client: DatabaseClient = client_1.software_manager.software.get("DatabaseClient")
|
||||
database_client: DatabaseClient = client_1.software_manager.software.get("database-client")
|
||||
assert database_client.config.fixing_duration == 1
|
||||
|
||||
database_service: DatabaseService = client_1.software_manager.software.get("DatabaseService")
|
||||
database_service: DatabaseService = client_1.software_manager.software.get("database-service")
|
||||
assert database_service.config.fixing_duration == 5
|
||||
|
||||
Reference in New Issue
Block a user