-
Notifications
You must be signed in to change notification settings - Fork 274
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: selection of osram lightify plugs
- Loading branch information
1 parent
7822827
commit 3cdd9a2
Showing
8 changed files
with
70 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
from selectors import SelectSelector | ||
|
||
from homeassistant import data_entry_flow | ||
from homeassistant.const import CONF_ENTITY_ID | ||
from homeassistant.core import HomeAssistant | ||
|
||
from custom_components.powercalc.config_flow import CONF_CONFIRM_AUTODISCOVERED_MODEL, Step | ||
from custom_components.powercalc.const import ( | ||
CONF_MANUFACTURER, | ||
) | ||
from tests.config_flow.common import select_menu_item | ||
from tests.conftest import MockEntityWithModel | ||
|
||
|
||
async def test_lightify_plug_selectable( | ||
hass: HomeAssistant, | ||
mock_entity_with_model_information: MockEntityWithModel, | ||
) -> None: | ||
""" | ||
See https://github.com/bramstroker/homeassistant-powercalc/issues/2858 | ||
""" | ||
mock_entity_with_model_information( | ||
"light.test", | ||
"osram", | ||
"LIGHTIFY Plug 01", | ||
platform="osramlightify", | ||
) | ||
|
||
result = await select_menu_item(hass, Step.MENU_LIBRARY) | ||
result = await hass.config_entries.flow.async_configure( | ||
result["flow_id"], | ||
{CONF_ENTITY_ID: "light.test"}, | ||
) | ||
result = await hass.config_entries.flow.async_configure( | ||
result["flow_id"], | ||
{CONF_CONFIRM_AUTODISCOVERED_MODEL: False}, | ||
) | ||
result = await hass.config_entries.flow.async_configure( | ||
result["flow_id"], | ||
{ | ||
CONF_MANUFACTURER: "osram", | ||
}, | ||
) | ||
assert result["type"] == data_entry_flow.FlowResultType.FORM | ||
data_schema = result["data_schema"] | ||
model_select: SelectSelector = data_schema.schema["model"] | ||
model_options = model_select.config["options"] | ||
assert {"value": "LIGHTIFY Plug 01", "label": "LIGHTIFY Plug 01"} in model_options |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters