File: test_legacy_anna.py

package info (click to toggle)
python-plugwise 1.7.8-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,072 kB
  • sloc: xml: 90,058; python: 5,265; sh: 324; makefile: 2
file content (77 lines) | stat: -rw-r--r-- 2,544 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
"""Test Plugwise module Anna related functionality."""

import pytest

from .test_init import _LOGGER, TestPlugwise

SMILE_TYPE = "anna"
# Reoccuring constants
THERMOSTAT_SCHEDULE = "Thermostat schedule"


class TestPlugwiseAnna(TestPlugwise):  # pylint: disable=attribute-defined-outside-init
    """Tests for Anna standalone, i.e. not combined with Adam."""

    @pytest.mark.asyncio
    async def test_connect_legacy_anna(self):
        """Test a legacy Anna device."""
        self.smile_setup = "legacy_anna"
        testdata = await self.load_testdata(SMILE_TYPE, self.smile_setup)

        server, api, client = await self.connect_legacy_wrapper()
        assert api.smile.hostname == "smile000000"

        self.validate_test_basics(
            _LOGGER,
            api,
            smile_version="1.8.22",
            smile_legacy=True,
        )

        await self.device_test(api, "2020-03-22 00:00:01", testdata)
        assert api.gateway_id == "0000aaaa0000aaaa0000aaaa0000aa00"
        assert self.entity_items == 43
        assert not api.reboot

        result = await self.tinker_legacy_thermostat(api, schedule_on=False)
        assert result

        await api.close_connection()
        await self.disconnect(server, client)

        server, api, client = await self.connect_legacy_wrapper(raise_timeout=True)
        await self.device_test(api, "2020-03-22 00:00:01", testdata, skip_testing=True)
        result = await self.tinker_legacy_thermostat(api, unhappy=True)
        assert result
        await api.close_connection()
        await self.disconnect(server, client)

    @pytest.mark.asyncio
    async def test_connect_legacy_anna_2(self):
        """Test another legacy Anna device."""
        self.smile_setup = "legacy_anna_2"

        testdata = await self.load_testdata(SMILE_TYPE, self.smile_setup)
        server, api, client = await self.connect_legacy_wrapper()
        assert api.smile.hostname == "smile000000"

        self.validate_test_basics(
            _LOGGER,
            api,
            smile_version="1.8.22",
            smile_legacy=True,
        )

        await self.device_test(api, "2020-05-03 00:00:01", testdata)

        assert api.gateway_id == "be81e3f8275b4129852c4d8d550ae2eb"
        assert self.entity_items == 43

        result = await self.tinker_legacy_thermostat(api)
        assert result

        result = await self.tinker_legacy_thermostat_schedule(api, "on")
        assert result

        await api.close_connection()
        await self.disconnect(server, client)