Skip to content

Commit f8fe09d

Browse files
committed
tests: Add some placeholder json endpoint tests
The endpoints "Server" and "log" have not been fully implemented in the simulator api. Neither in the html or json API. To account for some of the endpoints in the future, add a placeholder for the calls to make sure they are filled in once the implementation is finished. Signed-off-by: Esa Laakso <[email protected]>
1 parent 9fa0654 commit f8fe09d

File tree

1 file changed

+80
-0
lines changed

1 file changed

+80
-0
lines changed

test/sub_server/test_simulator_api.py

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,3 +387,83 @@ async def test_calls_json_simulate_reset_with_simulation(self, client, simulator
387387

388388
json_response = await resp.json()
389389
assert json_response["result"] == "ok"
390+
391+
@pytest.mark.asyncio()
392+
async def test_log_json_download(self, client, simulator):
393+
"""
394+
Test the /api/log_json endpoint with a download request.
395+
396+
This test is just a placeholder at the moment to make sure the endpoint
397+
is reachable. The actual functionality is not implemented.
398+
"""
399+
url = f"http://{simulator.http_host}:{simulator.http_port}/api/log_json"
400+
data = {
401+
"submit": "Download",
402+
}
403+
404+
# The call is undefined. Just make sure it returns 200
405+
async with client.post(url, json=data) as resp:
406+
assert resp.status == 200
407+
408+
json_response = await resp.json()
409+
assert json_response["error"] == "log endpoint not implemented"
410+
411+
@pytest.mark.asyncio()
412+
async def test_log_json_monitor(self, client, simulator):
413+
"""
414+
Test the /api/log_json endpoint with a monitor request.
415+
416+
This test is just a placeholder at the moment to make sure the endpoint
417+
is reachable. The actual functionality is not implemented.
418+
"""
419+
url = f"http://{simulator.http_host}:{simulator.http_port}/api/log_json"
420+
data = {
421+
"submit": "Monitor",
422+
}
423+
424+
# The call is undefined. Just make sure it returns 200
425+
async with client.post(url, json=data) as resp:
426+
assert resp.status == 200
427+
428+
json_response = await resp.json()
429+
assert json_response["error"] == "log endpoint not implemented"
430+
431+
@pytest.mark.asyncio()
432+
async def test_log_json_clear(self, client, simulator):
433+
"""
434+
Test the /api/log_json endpoint with a clear request.
435+
436+
This test is just a placeholder at the moment to make sure the endpoint
437+
is reachable. The actual functionality is not implemented.
438+
"""
439+
url = f"http://{simulator.http_host}:{simulator.http_port}/api/log_json"
440+
data = {
441+
"submit": "Clear",
442+
}
443+
444+
# The call is undefined. Just make sure it returns 200
445+
async with client.post(url, json=data) as resp:
446+
assert resp.status == 200
447+
448+
json_response = await resp.json()
449+
assert json_response["error"] == "log endpoint not implemented"
450+
451+
@pytest.mark.asyncio()
452+
async def test_server_json_restart(self, client, simulator):
453+
"""
454+
Test the /api/server_json endpoint with a restart request.
455+
456+
This test is just a placeholder at the moment to make sure the endpoint
457+
is reachable. The actual functionality is not implemented.
458+
"""
459+
url = f"http://{simulator.http_host}:{simulator.http_port}/api/server_json"
460+
data = {
461+
"submit": "Restart",
462+
}
463+
464+
# The call is undefined. Just make sure it returns 200
465+
async with client.post(url, json=data) as resp:
466+
assert resp.status == 200
467+
468+
json_response = await resp.json()
469+
assert json_response["error"] == "server endpoint not implemented"

0 commit comments

Comments
 (0)