コード例 #1
0
async def test_get_holiday_mode(manager: SystemManager,
                                resp: aioresponses) -> None:
    url = urls.system_holiday_mode(serial=SERIAL, )

    with open(path("files/responses/holiday_mode"), "r") as file:
        json_raw = json.loads(file.read())

    resp.get(url, status=200, payload=json_raw)

    await manager.get_holiday_mode()
    _assert_calls(1, manager, [url])
コード例 #2
0
async def test_set_holiday_mode(manager: SystemManager,
                                resp: aioresponses) -> None:
    tomorrow = date.today() + timedelta(days=1)
    after_tomorrow = tomorrow + timedelta(days=1)

    url = urls.system_holiday_mode(serial=SERIAL)
    resp.put(url, status=200)
    payload = payloads.holiday_mode(True, tomorrow, after_tomorrow, 15.0)

    await manager.set_holiday_mode(tomorrow, after_tomorrow, 15)
    _assert_calls(1, manager, [url], [payload])
コード例 #3
0
async def test_remove_holiday_mode(manager: SystemManager,
                                   resp: aioresponses) -> None:
    yesterday = date.today() - timedelta(days=1)
    before_yesterday = yesterday - timedelta(days=1)

    url = urls.system_holiday_mode(serial=SERIAL)
    resp.put(url, status=200)
    payload = payloads.holiday_mode(False, before_yesterday, yesterday,
                                    constants.FROST_PROTECTION_TEMP)

    await manager.remove_holiday_mode()
    _assert_calls(1, manager, [url], [payload])