mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 00:37:53 +00:00
Fix todoist todo tests (#103101)
This commit is contained in:
parent
df814af076
commit
64f8967739
@ -56,12 +56,12 @@ async def test_todo_item_state(
|
||||
|
||||
|
||||
@pytest.mark.parametrize(("tasks"), [[]])
|
||||
async def test_create_todo_list_item(
|
||||
async def test_add_todo_list_item(
|
||||
hass: HomeAssistant,
|
||||
setup_integration: None,
|
||||
api: AsyncMock,
|
||||
) -> None:
|
||||
"""Test for creating a To-do Item."""
|
||||
"""Test for adding a To-do Item."""
|
||||
|
||||
state = hass.states.get("todo.name")
|
||||
assert state
|
||||
@ -75,8 +75,8 @@ async def test_create_todo_list_item(
|
||||
|
||||
await hass.services.async_call(
|
||||
TODO_DOMAIN,
|
||||
"create_item",
|
||||
{"summary": "Soda"},
|
||||
"add_item",
|
||||
{"item": "Soda"},
|
||||
target={"entity_id": "todo.name"},
|
||||
blocking=True,
|
||||
)
|
||||
@ -92,30 +92,6 @@ async def test_create_todo_list_item(
|
||||
assert state.state == "1"
|
||||
|
||||
|
||||
@pytest.mark.parametrize(("tasks"), [[]])
|
||||
async def test_create_completed_item_unsupported(
|
||||
hass: HomeAssistant,
|
||||
setup_integration: None,
|
||||
api: AsyncMock,
|
||||
) -> None:
|
||||
"""Test for creating a To-do Item that is already completed."""
|
||||
|
||||
state = hass.states.get("todo.name")
|
||||
assert state
|
||||
assert state.state == "0"
|
||||
|
||||
api.add_task = AsyncMock()
|
||||
|
||||
with pytest.raises(ValueError, match="Only active tasks"):
|
||||
await hass.services.async_call(
|
||||
TODO_DOMAIN,
|
||||
"create_item",
|
||||
{"summary": "Soda", "status": "completed"},
|
||||
target={"entity_id": "todo.name"},
|
||||
blocking=True,
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("tasks"), [[make_api_task(id="task-id-1", content="Soda", is_completed=False)]]
|
||||
)
|
||||
@ -141,7 +117,7 @@ async def test_update_todo_item_status(
|
||||
await hass.services.async_call(
|
||||
TODO_DOMAIN,
|
||||
"update_item",
|
||||
{"uid": "task-id-1", "status": "completed"},
|
||||
{"item": "task-id-1", "status": "completed"},
|
||||
target={"entity_id": "todo.name"},
|
||||
blocking=True,
|
||||
)
|
||||
@ -164,7 +140,7 @@ async def test_update_todo_item_status(
|
||||
await hass.services.async_call(
|
||||
TODO_DOMAIN,
|
||||
"update_item",
|
||||
{"uid": "task-id-1", "status": "needs_action"},
|
||||
{"item": "task-id-1", "status": "needs_action"},
|
||||
target={"entity_id": "todo.name"},
|
||||
blocking=True,
|
||||
)
|
||||
@ -203,7 +179,7 @@ async def test_update_todo_item_summary(
|
||||
await hass.services.async_call(
|
||||
TODO_DOMAIN,
|
||||
"update_item",
|
||||
{"uid": "task-id-1", "summary": "Milk"},
|
||||
{"item": "task-id-1", "rename": "Milk"},
|
||||
target={"entity_id": "todo.name"},
|
||||
blocking=True,
|
||||
)
|
||||
@ -223,12 +199,12 @@ async def test_update_todo_item_summary(
|
||||
]
|
||||
],
|
||||
)
|
||||
async def test_delete_todo_item(
|
||||
async def test_remove_todo_item(
|
||||
hass: HomeAssistant,
|
||||
setup_integration: None,
|
||||
api: AsyncMock,
|
||||
) -> None:
|
||||
"""Test for deleting a To-do Item."""
|
||||
"""Test for removing a To-do Item."""
|
||||
|
||||
state = hass.states.get("todo.name")
|
||||
assert state
|
||||
@ -240,8 +216,8 @@ async def test_delete_todo_item(
|
||||
|
||||
await hass.services.async_call(
|
||||
TODO_DOMAIN,
|
||||
"delete_item",
|
||||
{"uid": ["task-id-1", "task-id-2"]},
|
||||
"remove_item",
|
||||
{"item": ["task-id-1", "task-id-2"]},
|
||||
target={"entity_id": "todo.name"},
|
||||
blocking=True,
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user