mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Avoid touching internals in Radarr tests (#119821)
* Avoid touching internals in Radarr tests * Fix * Fix
This commit is contained in:
parent
cfbc854c84
commit
9f46b582d3
@ -4,13 +4,12 @@ from datetime import timedelta
|
|||||||
|
|
||||||
from freezegun.api import FrozenDateTimeFactory
|
from freezegun.api import FrozenDateTimeFactory
|
||||||
|
|
||||||
from homeassistant.components.radarr.const import DOMAIN
|
|
||||||
from homeassistant.const import STATE_OFF, STATE_ON
|
from homeassistant.const import STATE_OFF, STATE_ON
|
||||||
from homeassistant.core import HomeAssistant
|
from homeassistant.core import HomeAssistant
|
||||||
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
|
|
||||||
|
|
||||||
from . import setup_integration
|
from . import setup_integration
|
||||||
|
|
||||||
|
from tests.common import async_fire_time_changed
|
||||||
from tests.test_util.aiohttp import AiohttpClientMocker
|
from tests.test_util.aiohttp import AiohttpClientMocker
|
||||||
|
|
||||||
|
|
||||||
@ -21,8 +20,7 @@ async def test_calendar(
|
|||||||
) -> None:
|
) -> None:
|
||||||
"""Test for successfully setting up the Radarr platform."""
|
"""Test for successfully setting up the Radarr platform."""
|
||||||
freezer.move_to("2021-12-02 00:00:00-08:00")
|
freezer.move_to("2021-12-02 00:00:00-08:00")
|
||||||
entry = await setup_integration(hass, aioclient_mock)
|
await setup_integration(hass, aioclient_mock)
|
||||||
coordinator: DataUpdateCoordinator = hass.data[DOMAIN][entry.entry_id]["calendar"]
|
|
||||||
|
|
||||||
state = hass.states.get("calendar.mock_title")
|
state = hass.states.get("calendar.mock_title")
|
||||||
assert state.state == STATE_ON
|
assert state.state == STATE_ON
|
||||||
@ -33,8 +31,9 @@ async def test_calendar(
|
|||||||
assert state.attributes.get("release_type") == "physicalRelease"
|
assert state.attributes.get("release_type") == "physicalRelease"
|
||||||
assert state.attributes.get("start_time") == "2021-12-02 00:00:00"
|
assert state.attributes.get("start_time") == "2021-12-02 00:00:00"
|
||||||
|
|
||||||
freezer.tick(timedelta(hours=16))
|
freezer.tick(timedelta(days=1))
|
||||||
await coordinator.async_refresh()
|
async_fire_time_changed(hass)
|
||||||
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
state = hass.states.get("calendar.mock_title")
|
state = hass.states.get("calendar.mock_title")
|
||||||
assert state.state == STATE_OFF
|
assert state.state == STATE_OFF
|
||||||
|
Loading…
x
Reference in New Issue
Block a user