コード例 #1
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])
コード例 #2
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])