mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-06-28 06:41:43 +00:00
feat: add healh-check like endpoint, support of healthcheck in docker compose
This commit is contained in:
1
tests/ahriman/web/schemas/test_info_schema.py
Normal file
1
tests/ahriman/web/schemas/test_info_schema.py
Normal file
@ -0,0 +1 @@
|
||||
# schema testing goes in view class tests
|
@ -0,0 +1,40 @@
|
||||
import pytest
|
||||
|
||||
from aiohttp.test_utils import TestClient
|
||||
|
||||
from ahriman import __version__
|
||||
from ahriman.models.repository_id import RepositoryId
|
||||
from ahriman.models.user_access import UserAccess
|
||||
from ahriman.web.views.v1.status.info import InfoView
|
||||
|
||||
|
||||
async def test_get_permission() -> None:
|
||||
"""
|
||||
must return correct permission for the request
|
||||
"""
|
||||
for method in ("GET",):
|
||||
request = pytest.helpers.request("", "", method)
|
||||
assert await InfoView.get_permission(request) == UserAccess.Unauthorized
|
||||
|
||||
|
||||
def test_routes() -> None:
|
||||
"""
|
||||
must return correct routes
|
||||
"""
|
||||
assert InfoView.ROUTES == ["/api/v1/info"]
|
||||
|
||||
|
||||
async def test_get(client: TestClient, repository_id: RepositoryId) -> None:
|
||||
"""
|
||||
must return service information
|
||||
"""
|
||||
response_schema = pytest.helpers.schema_response(InfoView.get)
|
||||
|
||||
response = await client.get(f"/api/v1/info")
|
||||
assert response.ok
|
||||
json = await response.json()
|
||||
assert not response_schema.validate(json)
|
||||
|
||||
assert json["repositories"] == [repository_id.view()]
|
||||
assert not json["auth"]
|
||||
assert json["version"] == __version__
|
@ -25,7 +25,7 @@ def test_routes() -> None:
|
||||
|
||||
async def test_get(client: TestClient, repository_id: RepositoryId) -> None:
|
||||
"""
|
||||
must return status for specific package
|
||||
must return list of available repositories
|
||||
"""
|
||||
response_schema = pytest.helpers.schema_response(RepositoriesView.get)
|
||||
|
||||
|
Reference in New Issue
Block a user