mirror of
https://github.com/home-assistant/core.git
synced 2026-04-02 00:20:30 +01:00
Mock TodoistAPIAsync in todoist failed coordinator update test (#164390)
This commit is contained in:
@@ -183,18 +183,21 @@ async def test_failed_coordinator_update(hass: HomeAssistant, api: AsyncMock) ->
|
||||
"""Test a failed data coordinator update is handled correctly."""
|
||||
api.get_tasks.side_effect = Exception("API error")
|
||||
|
||||
assert await setup.async_setup_component(
|
||||
hass,
|
||||
"calendar",
|
||||
{
|
||||
"calendar": {
|
||||
"platform": DOMAIN,
|
||||
CONF_TOKEN: "token",
|
||||
"custom_projects": [{"name": "All projects", "labels": ["Label1"]}],
|
||||
}
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
with patch(
|
||||
"homeassistant.components.todoist.calendar.TodoistAPIAsync", return_value=api
|
||||
):
|
||||
assert await setup.async_setup_component(
|
||||
hass,
|
||||
"calendar",
|
||||
{
|
||||
"calendar": {
|
||||
"platform": DOMAIN,
|
||||
CONF_TOKEN: "token",
|
||||
"custom_projects": [{"name": "All projects", "labels": ["Label1"]}],
|
||||
}
|
||||
},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
await async_update_entity(hass, "calendar.all_projects")
|
||||
state = hass.states.get("calendar.all_projects")
|
||||
|
||||
Reference in New Issue
Block a user