async def test_get_hvac_status(manager: SystemManager, resp: aioresponses) -> None: url = urls.hvac(serial=SERIAL, ) with open(path("files/responses/hvacstate"), "r") as file: json_raw = json.loads(file.read()) resp.get(url, status=200, payload=json_raw) await manager.get_hvac_status() _assert_calls(1, manager, [url])
async def test_request_hvac_not_sync(manager: SystemManager, resp: aioresponses) -> None: url_update = urls.hvac_update(serial=SERIAL) resp.put(url_update, status=200) with open(path("files/responses/hvacstate_pending"), "r") as file: hvacstate_data = json.loads(file.read()) url_hvac = urls.hvac(serial=SERIAL) resp.get(url_hvac, payload=hvacstate_data, status=200) await manager.request_hvac_update() _assert_calls(1, manager, [url_hvac])
def _mock_urls(resp: aioresponses, hvacstate_data: Any, livereport_data: Any, rooms_data: Any, system_data: Any, facilities: Any = None, gateway: Any = None) -> None: resp.get(urls.live_report(serial=SERIAL), payload=livereport_data, status=200) resp.get(urls.rooms(serial=SERIAL), payload=rooms_data, status=200) resp.get(urls.system(serial=SERIAL), payload=system_data, status=200) resp.get(urls.hvac(serial=SERIAL), payload=hvacstate_data, status=200) if facilities: resp.get(urls.facilities_list(), payload=facilities, status=200) if gateway: resp.get(urls.gateway_type(serial=SERIAL), payload=gateway, status=200)