From ce9abdb520a0c191b26b1a36d28ea285ef06aa42 Mon Sep 17 00:00:00 2001 From: Robert Hillis Date: Wed, 22 Dec 2021 00:01:01 -0500 Subject: [PATCH] Use platform enums in ring tests (#62565) --- tests/components/ring/test_light.py | 12 ++++++------ tests/components/ring/test_switch.py | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/components/ring/test_light.py b/tests/components/ring/test_light.py index 1b8150364bc..86c6033f480 100644 --- a/tests/components/ring/test_light.py +++ b/tests/components/ring/test_light.py @@ -1,5 +1,5 @@ """The tests for the Ring light platform.""" -from homeassistant.components.light import DOMAIN as LIGHT_DOMAIN +from homeassistant.const import Platform from homeassistant.helpers import entity_registry as er from .common import setup_platform @@ -9,7 +9,7 @@ from tests.common import load_fixture async def test_entity_registry(hass, requests_mock): """Tests that the devices are registered in the entity registry.""" - await setup_platform(hass, LIGHT_DOMAIN) + await setup_platform(hass, Platform.LIGHT) entity_registry = er.async_get(hass) entry = entity_registry.async_get("light.front_light") @@ -21,7 +21,7 @@ async def test_entity_registry(hass, requests_mock): async def test_light_off_reports_correctly(hass, requests_mock): """Tests that the initial state of a device that should be off is correct.""" - await setup_platform(hass, LIGHT_DOMAIN) + await setup_platform(hass, Platform.LIGHT) state = hass.states.get("light.front_light") assert state.state == "off" @@ -30,7 +30,7 @@ async def test_light_off_reports_correctly(hass, requests_mock): async def test_light_on_reports_correctly(hass, requests_mock): """Tests that the initial state of a device that should be on is correct.""" - await setup_platform(hass, LIGHT_DOMAIN) + await setup_platform(hass, Platform.LIGHT) state = hass.states.get("light.internal_light") assert state.state == "on" @@ -39,7 +39,7 @@ async def test_light_on_reports_correctly(hass, requests_mock): async def test_light_can_be_turned_on(hass, requests_mock): """Tests the light turns on correctly.""" - await setup_platform(hass, LIGHT_DOMAIN) + await setup_platform(hass, Platform.LIGHT) # Mocks the response for turning a light on requests_mock.put( @@ -61,7 +61,7 @@ async def test_light_can_be_turned_on(hass, requests_mock): async def test_updates_work(hass, requests_mock): """Tests the update service works correctly.""" - await setup_platform(hass, LIGHT_DOMAIN) + await setup_platform(hass, Platform.LIGHT) state = hass.states.get("light.front_light") assert state.state == "off" # Changes the return to indicate that the light is now on. diff --git a/tests/components/ring/test_switch.py b/tests/components/ring/test_switch.py index ed4e9024292..14d0a8b213f 100644 --- a/tests/components/ring/test_switch.py +++ b/tests/components/ring/test_switch.py @@ -1,5 +1,5 @@ """The tests for the Ring switch platform.""" -from homeassistant.components.switch import DOMAIN as SWITCH_DOMAIN +from homeassistant.const import Platform from homeassistant.helpers import entity_registry as er from .common import setup_platform @@ -9,7 +9,7 @@ from tests.common import load_fixture async def test_entity_registry(hass, requests_mock): """Tests that the devices are registered in the entity registry.""" - await setup_platform(hass, SWITCH_DOMAIN) + await setup_platform(hass, Platform.SWITCH) entity_registry = er.async_get(hass) entry = entity_registry.async_get("switch.front_siren") @@ -21,7 +21,7 @@ async def test_entity_registry(hass, requests_mock): async def test_siren_off_reports_correctly(hass, requests_mock): """Tests that the initial state of a device that should be off is correct.""" - await setup_platform(hass, SWITCH_DOMAIN) + await setup_platform(hass, Platform.SWITCH) state = hass.states.get("switch.front_siren") assert state.state == "off" @@ -30,7 +30,7 @@ async def test_siren_off_reports_correctly(hass, requests_mock): async def test_siren_on_reports_correctly(hass, requests_mock): """Tests that the initial state of a device that should be on is correct.""" - await setup_platform(hass, SWITCH_DOMAIN) + await setup_platform(hass, Platform.SWITCH) state = hass.states.get("switch.internal_siren") assert state.state == "on" @@ -40,7 +40,7 @@ async def test_siren_on_reports_correctly(hass, requests_mock): async def test_siren_can_be_turned_on(hass, requests_mock): """Tests the siren turns on correctly.""" - await setup_platform(hass, SWITCH_DOMAIN) + await setup_platform(hass, Platform.SWITCH) # Mocks the response for turning a siren on requests_mock.put( @@ -62,7 +62,7 @@ async def test_siren_can_be_turned_on(hass, requests_mock): async def test_updates_work(hass, requests_mock): """Tests the update service works correctly.""" - await setup_platform(hass, SWITCH_DOMAIN) + await setup_platform(hass, Platform.SWITCH) state = hass.states.get("switch.front_siren") assert state.state == "off" # Changes the return to indicate that the siren is now on.