mirror of
https://github.com/home-assistant/core.git
synced 2025-07-14 00:37:13 +00:00
Use platform enums in ring tests (#62565)
This commit is contained in:
parent
bf108b9d0d
commit
ce9abdb520
@ -1,5 +1,5 @@
|
|||||||
"""The tests for the Ring light platform."""
|
"""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 homeassistant.helpers import entity_registry as er
|
||||||
|
|
||||||
from .common import setup_platform
|
from .common import setup_platform
|
||||||
@ -9,7 +9,7 @@ from tests.common import load_fixture
|
|||||||
|
|
||||||
async def test_entity_registry(hass, requests_mock):
|
async def test_entity_registry(hass, requests_mock):
|
||||||
"""Tests that the devices are registered in the entity registry."""
|
"""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)
|
entity_registry = er.async_get(hass)
|
||||||
|
|
||||||
entry = entity_registry.async_get("light.front_light")
|
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):
|
async def test_light_off_reports_correctly(hass, requests_mock):
|
||||||
"""Tests that the initial state of a device that should be off is correct."""
|
"""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")
|
state = hass.states.get("light.front_light")
|
||||||
assert state.state == "off"
|
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):
|
async def test_light_on_reports_correctly(hass, requests_mock):
|
||||||
"""Tests that the initial state of a device that should be on is correct."""
|
"""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")
|
state = hass.states.get("light.internal_light")
|
||||||
assert state.state == "on"
|
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):
|
async def test_light_can_be_turned_on(hass, requests_mock):
|
||||||
"""Tests the light turns on correctly."""
|
"""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
|
# Mocks the response for turning a light on
|
||||||
requests_mock.put(
|
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):
|
async def test_updates_work(hass, requests_mock):
|
||||||
"""Tests the update service works correctly."""
|
"""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")
|
state = hass.states.get("light.front_light")
|
||||||
assert state.state == "off"
|
assert state.state == "off"
|
||||||
# Changes the return to indicate that the light is now on.
|
# Changes the return to indicate that the light is now on.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
"""The tests for the Ring switch platform."""
|
"""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 homeassistant.helpers import entity_registry as er
|
||||||
|
|
||||||
from .common import setup_platform
|
from .common import setup_platform
|
||||||
@ -9,7 +9,7 @@ from tests.common import load_fixture
|
|||||||
|
|
||||||
async def test_entity_registry(hass, requests_mock):
|
async def test_entity_registry(hass, requests_mock):
|
||||||
"""Tests that the devices are registered in the entity registry."""
|
"""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)
|
entity_registry = er.async_get(hass)
|
||||||
|
|
||||||
entry = entity_registry.async_get("switch.front_siren")
|
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):
|
async def test_siren_off_reports_correctly(hass, requests_mock):
|
||||||
"""Tests that the initial state of a device that should be off is correct."""
|
"""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")
|
state = hass.states.get("switch.front_siren")
|
||||||
assert state.state == "off"
|
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):
|
async def test_siren_on_reports_correctly(hass, requests_mock):
|
||||||
"""Tests that the initial state of a device that should be on is correct."""
|
"""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")
|
state = hass.states.get("switch.internal_siren")
|
||||||
assert state.state == "on"
|
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):
|
async def test_siren_can_be_turned_on(hass, requests_mock):
|
||||||
"""Tests the siren turns on correctly."""
|
"""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
|
# Mocks the response for turning a siren on
|
||||||
requests_mock.put(
|
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):
|
async def test_updates_work(hass, requests_mock):
|
||||||
"""Tests the update service works correctly."""
|
"""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")
|
state = hass.states.get("switch.front_siren")
|
||||||
assert state.state == "off"
|
assert state.state == "off"
|
||||||
# Changes the return to indicate that the siren is now on.
|
# Changes the return to indicate that the siren is now on.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user