#1859 - Integrated the runtime execution for web client. Added in the webclient application execution action. Now fixing http status code issues.

This commit is contained in:
Chris McCarthy
2023-11-27 13:47:59 +00:00
parent 84bd9b1bff
commit 4d4a578555
9 changed files with 46 additions and 29 deletions

View File

@@ -3,7 +3,6 @@ from primaite.simulator.network.hardware.nodes.server import Server
from primaite.simulator.network.protocols.http import HttpStatusCode
from primaite.simulator.system.applications.application import ApplicationOperatingState
from primaite.simulator.system.applications.web_browser import WebBrowser
from primaite.simulator.system.services.service import ServiceOperatingState
def test_web_page_home_page(uc2_network):
@@ -11,9 +10,10 @@ def test_web_page_home_page(uc2_network):
client_1: Computer = uc2_network.get_node_by_hostname("client_1")
web_client: WebBrowser = client_1.software_manager.software["WebBrowser"]
web_client.run()
web_client.target_url = "http://arcd.com/"
assert web_client.operating_state == ApplicationOperatingState.RUNNING
assert web_client.get_webpage("http://arcd.com/") is True
assert web_client.get_webpage() is True
# latest reponse should have status code 200
assert web_client.latest_response is not None
@@ -27,7 +27,7 @@ def test_web_page_get_users_page_request_with_domain_name(uc2_network):
web_client.run()
assert web_client.operating_state == ApplicationOperatingState.RUNNING
assert web_client.get_webpage("http://arcd.com/users/") is True
assert web_client.get_webpage() is True
# latest reponse should have status code 200
assert web_client.latest_response is not None
@@ -41,11 +41,12 @@ def test_web_page_get_users_page_request_with_ip_address(uc2_network):
web_client.run()
web_server: Server = uc2_network.get_node_by_hostname("web_server")
web_server_ip = web_server.nics.get(next(iter(web_server.nics))).ip_address
web_server_ip = web_server.nics.get(next(iter(web_server.nics))).ip_address
web_client.target_url = f"http://{web_server_ip}/users/"
assert web_client.operating_state == ApplicationOperatingState.RUNNING
assert web_client.get_webpage(f"http://{web_server_ip}/users/") is True
assert web_client.get_webpage() is True
# latest reponse should have status code 200
assert web_client.latest_response is not None