Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
gjohansson-ST committed May 24, 2023
1 parent 85bf5b0 commit 046b804
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions tests/components/timer/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@
)
from homeassistant.core import Context, CoreState, HomeAssistant, State
from homeassistant.exceptions import HomeAssistantError, Unauthorized
from homeassistant.helpers import config_validation as cv, entity_registry as er
from homeassistant.helpers import (
config_validation as cv,
entity_registry as er,
issue_registry as ir,
)
from homeassistant.helpers.restore_state import (
DATA_RESTORE_STATE_TASK,
RestoreStateData,
Expand Down Expand Up @@ -269,7 +273,9 @@ def fake_event_listener(event):
assert len(results) == expected_events


async def test_start_service(hass: HomeAssistant) -> None:
async def test_start_service(
hass: HomeAssistant, issue_registry: ir.IssueRegistry
) -> None:
"""Test the start/stop service."""
await async_setup_component(hass, DOMAIN, {DOMAIN: {"test1": {CONF_DURATION: 10}}})

Expand Down Expand Up @@ -314,6 +320,12 @@ async def test_start_service(hass: HomeAssistant) -> None:
blocking=True,
)
await hass.async_block_till_done()

# Ensure an issue is raised for the use of this deprecated service
assert issue_registry.async_get_issue(
domain=DOMAIN, issue_id="deprecated_duration_in_start"
)

state = hass.states.get("timer.test1")
assert state
assert state.state == STATUS_ACTIVE
Expand Down

0 comments on commit 046b804

Please sign in to comment.