mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 21:06:19 +00:00
Rewrite dyson fan test (#45295)
* Improve device fixture to take parameter * Remove unused code in dyson/fan * Rewrite dyson fan test
This commit is contained in:
@@ -18,8 +18,12 @@ BASE_PATH = "homeassistant.components.dyson"
|
||||
@pytest.fixture
|
||||
async def device(hass: HomeAssistant, request) -> DysonDevice:
|
||||
"""Fixture to provide Dyson 360 Eye device."""
|
||||
device = request.module.get_device()
|
||||
platform = request.module.PLATFORM_DOMAIN
|
||||
get_device = request.module.get_device
|
||||
if hasattr(request, "param"):
|
||||
device = get_device(request.param)
|
||||
else:
|
||||
device = get_device()
|
||||
with patch(f"{BASE_PATH}.DysonAccount.login", return_value=True), patch(
|
||||
f"{BASE_PATH}.DysonAccount.devices", return_value=[device]
|
||||
), patch(f"{BASE_PATH}.DYSON_PLATFORMS", [platform]):
|
||||
|
||||
Reference in New Issue
Block a user