Skip to content

Commit e58b9ad

Browse files
committed
add unit test for system usage
1 parent bc496dc commit e58b9ad

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/supervisor/test_views.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,16 @@ async def test_allocation_fails_on_invalid_item_hash(aiohttp_client):
2424
"type": "value_error.unknownhash",
2525
},
2626
]
27+
28+
29+
@pytest.mark.asyncio
30+
async def test_system_usage(aiohttp_client):
31+
"""Test that the allocation endpoint fails when an invalid item_hash is provided."""
32+
client = await aiohttp_client(app)
33+
settings.ALLOCATION_TOKEN_HASH = "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08" # = "test"
34+
response: web.Response = await client.get("/about/usage/system")
35+
assert response.status == 200
36+
# check if it is valid json
37+
resp = await response.json()
38+
assert "cpu" in resp
39+
assert resp["cpu"]["count"] > 0

0 commit comments

Comments
 (0)