File: test_apps.py

package info (click to toggle)
python-demetriek 1.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 544 kB
  • sloc: python: 1,400; makefile: 3
file content (43 lines) | stat: -rw-r--r-- 1,342 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
"""Asynchronous Python client for LaMetric TIME devices."""

# pylint: disable=protected-access
import aiohttp
from aresponses import ResponsesMockServer

from demetriek import LaMetricDevice

from . import load_fixture


async def test_app_next(aresponses: ResponsesMockServer) -> None:
    """Test switching to the next app."""
    aresponses.add(
        "127.0.0.2:4343",
        "/api/v2/device/apps/next",
        "PUT",
        aresponses.Response(
            status=200,
            headers={"Content-Type": "application/json"},
            text=load_fixture("apps_next.json"),
        ),
    )
    async with aiohttp.ClientSession() as session:
        demetriek = LaMetricDevice(host="127.0.0.2", api_key="abc", session=session)
        await demetriek.app_next()


async def test_app_previous(aresponses: ResponsesMockServer) -> None:
    """Test switching to the previous app."""
    aresponses.add(
        "127.0.0.2:4343",
        "/api/v2/device/apps/prev",
        "PUT",
        aresponses.Response(
            status=200,
            headers={"Content-Type": "application/json"},
            text=load_fixture("apps_prev.json"),
        ),
    )
    async with aiohttp.ClientSession() as session:
        demetriek = LaMetricDevice(host="127.0.0.2", api_key="abc", session=session)
        await demetriek.app_previous()