File: test_api_calls.py

package info (click to toggle)
pytraccar 3.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 456 kB
  • sloc: python: 786; makefile: 3
file content (44 lines) | stat: -rw-r--r-- 1,212 bytes parent folder | download
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