generated from Luis/nextjs-python-web-template
Services and entites now have correct url to emulated servers
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
host = "127.0.0.1"
|
||||
port_dlg = 7000
|
||||
port_ap = 7500
|
||||
port_client_base = 8000
|
||||
_port_client_base = 8000
|
||||
c1_port = _port_client_base + 1
|
||||
c2_port = _port_client_base + 2
|
||||
dlg_url = f"http://{host}:{port_dlg}/docs"
|
||||
ap_url = f"http://{host}:{port_ap}/docs"
|
||||
c1_url = f"http://{host}:{port_client_base}/docs"
|
||||
c2_url = f"http://{host}:{port_client_base + 1}/docs"
|
||||
c1_url = f"http://{host}:{c1_port}/docs"
|
||||
c2_url = f"http://{host}:{c2_port}/docs"
|
||||
|
||||
@@ -17,8 +17,8 @@ app_c2 = FastAPI(swagger_ui_parameters={"tryItOutEnabled": True})
|
||||
apps = [
|
||||
(app_dlg, config.port_dlg),
|
||||
(app_ap, config.port_ap),
|
||||
(app_c1, config.port_client_base),
|
||||
(app_c2, config.port_client_base + 1),
|
||||
(app_c1, config.c1_port),
|
||||
(app_c2, config.c2_port),
|
||||
]
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ def get_health(*, url: str, max_retries: int = 20, delay: float = 0.2) -> str |
|
||||
# TODO send_msg???
|
||||
|
||||
|
||||
@app_c1.get("/consume_service_from_other_entity", response_class=HTMLResponse)
|
||||
@app_c1.get("/v1/print_daemon1", response_class=HTMLResponse)
|
||||
async def consume_service_from_other_entity_c1() -> HTMLResponse:
|
||||
html_content = """
|
||||
<html>
|
||||
@@ -92,7 +92,17 @@ async def consume_service_from_other_entity_c1() -> HTMLResponse:
|
||||
return HTMLResponse(content=html_content, status_code=200)
|
||||
|
||||
|
||||
@app_c2.get("/consume_service_from_other_entity", response_class=HTMLResponse)
|
||||
@app_c1.get("/v1/print_daemon1/register", response_class=JSONResponse)
|
||||
async def register_c1() -> JSONResponse:
|
||||
return JSONResponse(content={"status": "registered"}, status_code=200)
|
||||
|
||||
|
||||
@app_c1.get("/v1/print_daemon1/deregister", response_class=JSONResponse)
|
||||
async def deregister_c1() -> JSONResponse:
|
||||
return JSONResponse(content={"status": "deregistered"}, status_code=200)
|
||||
|
||||
|
||||
@app_c2.get("/v1/print_daemon2", response_class=HTMLResponse)
|
||||
async def consume_service_from_other_entity_c2() -> HTMLResponse:
|
||||
html_content = """
|
||||
<html>
|
||||
@@ -105,6 +115,16 @@ async def consume_service_from_other_entity_c2() -> HTMLResponse:
|
||||
return HTMLResponse(content=html_content, status_code=200)
|
||||
|
||||
|
||||
@app_c2.get("/v1/print_daemon1/register", response_class=JSONResponse)
|
||||
async def register_c2() -> JSONResponse:
|
||||
return JSONResponse(content={"status": "registered"}, status_code=200)
|
||||
|
||||
|
||||
@app_c2.get("/v1/print_daemon1/deregister", response_class=JSONResponse)
|
||||
async def deregister_c2() -> JSONResponse:
|
||||
return JSONResponse(content={"status": "deregistered"}, status_code=200)
|
||||
|
||||
|
||||
@app_ap.get("/ap_list_of_services", response_class=JSONResponse)
|
||||
async def ap_list_of_services() -> JSONResponse:
|
||||
res = [
|
||||
|
||||
@@ -26,7 +26,7 @@ random.seed(42)
|
||||
host = config.host
|
||||
port_dlg = config.port_dlg
|
||||
port_ap = config.port_ap
|
||||
port_client_base = config.port_client_base
|
||||
port_client_base = config._port_client_base
|
||||
|
||||
num_uuids = 100
|
||||
uuids = [str(uuid.UUID(int=random.getrandbits(128))) for i in range(num_uuids)]
|
||||
@@ -38,7 +38,7 @@ def test_health(api_client: ApiClient) -> None:
|
||||
assert res.status == Status.ONLINE
|
||||
|
||||
|
||||
def create_entities(num: int = 10, role: str = "entity") -> list[EntityCreate]:
|
||||
def create_entities(num: int = 5, role: str = "entity") -> list[EntityCreate]:
|
||||
res = []
|
||||
for i in range(num):
|
||||
en = EntityCreate(
|
||||
@@ -108,8 +108,7 @@ def test_create_services(api_client: ApiClient) -> None:
|
||||
sapi = ServicesApi(api_client=api_client)
|
||||
eapi = EntitiesApi(api_client=api_client)
|
||||
for midx, entity in enumerate(eapi.get_all_entities()):
|
||||
for idx in range(4):
|
||||
service_obj = create_service(idx + 4 * midx, entity)
|
||||
service_obj = create_service(midx, entity)
|
||||
service = sapi.create_service(service_obj)
|
||||
assert service.uuid == service_obj.uuid
|
||||
|
||||
|
||||
@@ -45,6 +45,18 @@ const menuEntityEntries: MenuEntry[] = [
|
||||
to: "/client/C2",
|
||||
disabled: false,
|
||||
},
|
||||
{
|
||||
icon: <PersonIcon />,
|
||||
label: "C3",
|
||||
to: "/client/C3",
|
||||
disabled: false,
|
||||
},
|
||||
{
|
||||
icon: <PersonIcon />,
|
||||
label: "C4",
|
||||
to: "/client/C4",
|
||||
disabled: false,
|
||||
},
|
||||
];
|
||||
|
||||
const menuEntries: MenuEntry[] = [
|
||||
|
||||
Reference in New Issue
Block a user