Use platform enums in ring tests (#62565)

pull/62572/head
Robert Hillis 2021-12-22 00:01:01 -05:00 committed by GitHub
parent bf108b9d0d
commit ce9abdb520
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 12 deletions

View File

@ -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.

View File

@ -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.