Skip to content

Commit

Permalink
add unit test for system usage
Browse files Browse the repository at this point in the history
  • Loading branch information
olethanh committed Apr 29, 2024
1 parent bc496dc commit e58b9ad
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/supervisor/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,16 @@ async def test_allocation_fails_on_invalid_item_hash(aiohttp_client):
"type": "value_error.unknownhash",
},
]


@pytest.mark.asyncio
async def test_system_usage(aiohttp_client):
"""Test that the allocation endpoint fails when an invalid item_hash is provided."""
client = await aiohttp_client(app)
settings.ALLOCATION_TOKEN_HASH = "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08" # = "test"
response: web.Response = await client.get("/about/usage/system")
assert response.status == 200
# check if it is valid json
resp = await response.json()
assert "cpu" in resp
assert resp["cpu"]["count"] > 0

0 comments on commit e58b9ad

Please sign in to comment.