1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
|
"""Test API endpoint."""
import pytest
from pytraccar import ApiClient
@pytest.mark.asyncio
async def test_server(api_client: ApiClient) -> None:
"""Test /server endpoint."""
response = await api_client.get_server()
assert response["id"] == 0
@pytest.mark.asyncio
async def test_devices(api_client: ApiClient) -> None:
"""Test /devices endpoint."""
response = await api_client.get_devices()
assert isinstance(response, list)
assert response[0]["id"] == 0
@pytest.mark.asyncio
async def test_geofences(api_client: ApiClient) -> None:
"""Test /geofences endpoint."""
response = await api_client.get_geofences()
assert isinstance(response, list)
assert response[0]["id"] == 0
@pytest.mark.asyncio
async def test_positions(api_client: ApiClient) -> None:
"""Test /positions endpoint."""
response = await api_client.get_positions()
assert isinstance(response, list)
assert response[0]["id"] == 0
@pytest.mark.asyncio
async def test_reports_events(api_client: ApiClient) -> None:
"""Test /reports/events endpoint."""
response = await api_client.get_reports_events()
assert isinstance(response, list)
assert response[0]["id"] == 0
|