* init roborock commit * init commit of roborock * removed some non-vacuum related code * removed some non-needed constants * removed translations * removed options flow * removed manual control * remove password login * removed go-to * removed unneeded function and improved device_stat * removed utils as it is unused * typing changes in vacuum.py * fixed test patch paths * removed unneeded records * removing unneeded code in tests * remove password from strings * removed maps in code * changed const, reworked functions * remove menu * fixed tests * 100% code coverage config_flow * small changes * removed unneeded patch * bump to 0.1.7 * removed services * removed extra functions and mop * add () to configEntryNotReady * moved coordinator into seperate file * update roborock testing * removed stale options code * normalize username for unique id * removed unneeded variables * fixed linter problems * removed stale comment * additional pr changes * simplify config_flow * fix config flow test * Apply suggestions from code review Co-authored-by: Allen Porter <allen.porter@gmail.com> * First pass at resolving PR comments * reworked config flow * moving vacuum attr * attempt to clean up conflig flow more * update package and use offline functionality * Fixed errors and fan bug * rework model and some other small changes * bump version * used default factory * moved some client creation into coord * fixed patch * Update homeassistant/components/roborock/coordinator.py Co-authored-by: Allen Porter <allen.porter@gmail.com> * moved async functions into gather * reworked gathers * removed random line * error catch if networking doesn't exist or timeout * bump to 0.6.5 * fixed mocked data reference url * change checking if we have no network information Co-authored-by: Allen Porter <allen.porter@gmail.com> --------- Co-authored-by: Allen Porter <allen.porter@gmail.com> Co-authored-by: Allen Porter <allen@thebends.org>
37 lines
1.2 KiB
Python
37 lines
1.2 KiB
Python
"""Common methods used across tests for Roborock."""
|
|
from unittest.mock import patch
|
|
|
|
from homeassistant.components.roborock.const import (
|
|
CONF_BASE_URL,
|
|
CONF_USER_DATA,
|
|
DOMAIN,
|
|
)
|
|
from homeassistant.const import CONF_USERNAME
|
|
from homeassistant.core import HomeAssistant
|
|
from homeassistant.setup import async_setup_component
|
|
|
|
from .mock_data import BASE_URL, HOME_DATA, USER_DATA, USER_EMAIL
|
|
|
|
from tests.common import MockConfigEntry
|
|
|
|
|
|
async def setup_platform(hass: HomeAssistant, platform: str) -> MockConfigEntry:
|
|
"""Set up the Roborock platform."""
|
|
mock_entry = MockConfigEntry(
|
|
domain=DOMAIN,
|
|
title=USER_EMAIL,
|
|
data={
|
|
CONF_USERNAME: USER_EMAIL,
|
|
CONF_USER_DATA: USER_DATA.as_dict(),
|
|
CONF_BASE_URL: BASE_URL,
|
|
},
|
|
)
|
|
mock_entry.add_to_hass(hass)
|
|
|
|
with patch("homeassistant.components.roborock.PLATFORMS", [platform]), patch(
|
|
"homeassistant.components.roborock.RoborockApiClient.get_home_data",
|
|
return_value=HOME_DATA,
|
|
), patch("homeassistant.components.roborock.RoborockMqttClient.get_networking"):
|
|
assert await async_setup_component(hass, DOMAIN, {})
|
|
await hass.async_block_till_done()
|
|
return mock_entry
|