Skip to content

Commit a706db8

Browse files
authored
Minor polish of cover trigger tests (home-assistant#157397)
1 parent a00923c commit a706db8

File tree

1 file changed

+27
-28
lines changed

1 file changed

+27
-28
lines changed

tests/components/cover/test_trigger.py

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -41,34 +41,6 @@ async def target_covers(hass: HomeAssistant) -> list[str]:
4141
return await target_entities(hass, "cover")
4242

4343

44-
@pytest.mark.parametrize(
45-
"trigger_key",
46-
[
47-
"cover.awning_opened",
48-
"cover.blind_opened",
49-
"cover.curtain_opened",
50-
"cover.door_opened",
51-
"cover.garage_opened",
52-
"cover.gate_opened",
53-
"cover.shade_opened",
54-
"cover.shutter_opened",
55-
"cover.window_opened",
56-
],
57-
)
58-
async def test_cover_triggers_gated_by_labs_flag(
59-
hass: HomeAssistant, caplog: pytest.LogCaptureFixture, trigger_key: str
60-
) -> None:
61-
"""Test the cover triggers are gated by the labs flag."""
62-
await arm_trigger(hass, trigger_key, None, {ATTR_LABEL_ID: "test_label"})
63-
assert (
64-
"Unnamed automation failed to setup triggers and has been disabled: Trigger "
65-
f"'{trigger_key}' requires the experimental 'New triggers and conditions' "
66-
"feature to be enabled in Home Assistant Labs settings (feature flag: "
67-
"'new_triggers_conditions')"
68-
) in caplog.text
69-
70-
71-
@pytest.mark.usefixtures("enable_experimental_triggers_conditions")
7244
def parametrize_opened_trigger_states(
7345
trigger: str, device_class: str
7446
) -> list[tuple[str, dict, str, list[StateDescription]]]:
@@ -120,6 +92,33 @@ def parametrize_opened_trigger_states(
12092
]
12193

12294

95+
@pytest.mark.parametrize(
96+
"trigger_key",
97+
[
98+
"cover.awning_opened",
99+
"cover.blind_opened",
100+
"cover.curtain_opened",
101+
"cover.door_opened",
102+
"cover.garage_opened",
103+
"cover.gate_opened",
104+
"cover.shade_opened",
105+
"cover.shutter_opened",
106+
"cover.window_opened",
107+
],
108+
)
109+
async def test_cover_triggers_gated_by_labs_flag(
110+
hass: HomeAssistant, caplog: pytest.LogCaptureFixture, trigger_key: str
111+
) -> None:
112+
"""Test the cover triggers are gated by the labs flag."""
113+
await arm_trigger(hass, trigger_key, None, {ATTR_LABEL_ID: "test_label"})
114+
assert (
115+
"Unnamed automation failed to setup triggers and has been disabled: Trigger "
116+
f"'{trigger_key}' requires the experimental 'New triggers and conditions' "
117+
"feature to be enabled in Home Assistant Labs settings (feature flag: "
118+
"'new_triggers_conditions')"
119+
) in caplog.text
120+
121+
123122
@pytest.mark.usefixtures("enable_experimental_triggers_conditions")
124123
@pytest.mark.parametrize(
125124
("trigger_target_config", "entity_id", "entities_in_target"),

0 commit comments

Comments
 (0)