Skip to content

Commit 916de35

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 0114e24 commit 916de35

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
@@ -384,3 +384,83 @@ async def test_calls_json_simulate_reset_with_simulation(self, client, simulator
384384

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

0 commit comments

Comments
 (0)