#1943: unit tests + refactoring HTTP -> Http
This commit is contained in:
@@ -12,7 +12,7 @@ from primaite.simulator.system.applications.database_client import DatabaseClien
|
||||
from primaite.simulator.system.services.database.database_service import DatabaseService
|
||||
from primaite.simulator.system.services.dns.dns_server import DNSServer
|
||||
from primaite.simulator.system.services.red_services.data_manipulation_bot import DataManipulationBot
|
||||
from primaite.simulator.system.services.web_server.web_server_service import WebServer
|
||||
from primaite.simulator.system.services.web_server.web_server import WebServer
|
||||
|
||||
|
||||
def client_server_routed() -> Network:
|
||||
|
||||
@@ -3,7 +3,7 @@ from enum import Enum
|
||||
from primaite.simulator.network.protocols.packet import DataPacket
|
||||
|
||||
|
||||
class HTTPRequestMethod(Enum):
|
||||
class HttpRequestMethod(Enum):
|
||||
"""Enum list of HTTP Request methods that can be handled by the simulation."""
|
||||
|
||||
GET = "GET"
|
||||
@@ -25,7 +25,7 @@ class HTTPRequestMethod(Enum):
|
||||
"""Apply partial modifications to a resource."""
|
||||
|
||||
|
||||
class HTTPStatusCode(Enum):
|
||||
class HttpStatusCode(Enum):
|
||||
"""List of available HTTP Statuses."""
|
||||
|
||||
OK = 200
|
||||
@@ -37,6 +37,9 @@ class HTTPStatusCode(Enum):
|
||||
UNAUTHORIZED = 401
|
||||
"""Auth required."""
|
||||
|
||||
NOT_FOUND = 404
|
||||
"""Item not found in server."""
|
||||
|
||||
METHOD_NOT_ALLOWED = 405
|
||||
"""Method is not supported by server."""
|
||||
|
||||
@@ -44,18 +47,18 @@ class HTTPStatusCode(Enum):
|
||||
"""Error on the server side."""
|
||||
|
||||
|
||||
class HTTPRequestPacket(DataPacket):
|
||||
class HttpRequestPacket(DataPacket):
|
||||
"""Class that represents an HTTP Request Packet."""
|
||||
|
||||
request_method: HTTPRequestMethod
|
||||
request_method: HttpRequestMethod
|
||||
"""The HTTP Request method."""
|
||||
|
||||
request_url: str
|
||||
"""URL of request."""
|
||||
|
||||
|
||||
class HTTPResponsePacket(DataPacket):
|
||||
class HttpResponsePacket(DataPacket):
|
||||
"""Class that reprensents an HTTP Response Packet."""
|
||||
|
||||
status_code: HTTPStatusCode = None
|
||||
status_code: HttpStatusCode = None
|
||||
"""Status code of the HTTP response."""
|
||||
|
||||
Reference in New Issue
Block a user