mirror of
https://github.com/home-assistant/core.git
synced 2025-04-27 18:57:57 +00:00
Ensure entity platform in light tests (#135724)
This commit is contained in:
parent
b5a7d0258a
commit
c89d60fb5d
@ -2654,7 +2654,7 @@ def test_deprecated_supported_features_ints(caplog: pytest.LogCaptureFixture) ->
|
|||||||
(light.ColorMode.ONOFF, {light.ColorMode.ONOFF}, False),
|
(light.ColorMode.ONOFF, {light.ColorMode.ONOFF}, False),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_report_no_color_mode(
|
async def test_report_no_color_mode(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
caplog: pytest.LogCaptureFixture,
|
caplog: pytest.LogCaptureFixture,
|
||||||
color_mode: str,
|
color_mode: str,
|
||||||
@ -2670,6 +2670,8 @@ def test_report_no_color_mode(
|
|||||||
_attr_supported_color_modes = supported_color_modes
|
_attr_supported_color_modes = supported_color_modes
|
||||||
|
|
||||||
entity = MockLightEntityEntity()
|
entity = MockLightEntityEntity()
|
||||||
|
platform = MockEntityPlatform(hass, domain="test", platform_name="test")
|
||||||
|
await platform.async_add_entities([entity])
|
||||||
entity._async_calculate_state()
|
entity._async_calculate_state()
|
||||||
expected_warning = "does not report a color mode"
|
expected_warning = "does not report a color mode"
|
||||||
assert (expected_warning in caplog.text) is warning_expected
|
assert (expected_warning in caplog.text) is warning_expected
|
||||||
@ -2682,7 +2684,7 @@ def test_report_no_color_mode(
|
|||||||
(light.ColorMode.ONOFF, {light.ColorMode.ONOFF}, False),
|
(light.ColorMode.ONOFF, {light.ColorMode.ONOFF}, False),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_report_no_color_modes(
|
async def test_report_no_color_modes(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
caplog: pytest.LogCaptureFixture,
|
caplog: pytest.LogCaptureFixture,
|
||||||
color_mode: str,
|
color_mode: str,
|
||||||
@ -2698,6 +2700,8 @@ def test_report_no_color_modes(
|
|||||||
_attr_supported_color_modes = supported_color_modes
|
_attr_supported_color_modes = supported_color_modes
|
||||||
|
|
||||||
entity = MockLightEntityEntity()
|
entity = MockLightEntityEntity()
|
||||||
|
platform = MockEntityPlatform(hass, domain="test", platform_name="test")
|
||||||
|
await platform.async_add_entities([entity])
|
||||||
entity._async_calculate_state()
|
entity._async_calculate_state()
|
||||||
expected_warning = "does not set supported color modes"
|
expected_warning = "does not set supported color modes"
|
||||||
assert (expected_warning in caplog.text) is warning_expected
|
assert (expected_warning in caplog.text) is warning_expected
|
||||||
@ -2728,7 +2732,7 @@ def test_report_no_color_modes(
|
|||||||
(light.ColorMode.HS, {light.ColorMode.BRIGHTNESS}, "effect", True),
|
(light.ColorMode.HS, {light.ColorMode.BRIGHTNESS}, "effect", True),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_report_invalid_color_mode(
|
async def test_report_invalid_color_mode(
|
||||||
hass: HomeAssistant,
|
hass: HomeAssistant,
|
||||||
caplog: pytest.LogCaptureFixture,
|
caplog: pytest.LogCaptureFixture,
|
||||||
color_mode: str,
|
color_mode: str,
|
||||||
@ -2746,6 +2750,8 @@ def test_report_invalid_color_mode(
|
|||||||
_attr_supported_color_modes = supported_color_modes
|
_attr_supported_color_modes = supported_color_modes
|
||||||
|
|
||||||
entity = MockLightEntityEntity()
|
entity = MockLightEntityEntity()
|
||||||
|
platform = MockEntityPlatform(hass, domain="test", platform_name="test")
|
||||||
|
await platform.async_add_entities([entity])
|
||||||
entity._async_calculate_state()
|
entity._async_calculate_state()
|
||||||
expected_warning = f"set to unsupported color mode {color_mode}"
|
expected_warning = f"set to unsupported color mode {color_mode}"
|
||||||
assert (expected_warning in caplog.text) is warning_expected
|
assert (expected_warning in caplog.text) is warning_expected
|
||||||
|
Loading…
x
Reference in New Issue
Block a user