Skip to content

Commit 8ea603f

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 cfee403 commit 8ea603f

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

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

0 commit comments

Comments
 (0)