Exclude Todoist sub-tasks for the todo platform (#104914)

This commit is contained in:
Aaron Godfrey 2023-12-04 11:37:09 -08:00 committed by GitHub
parent 35e2f591c1
commit 677c50a7cc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 1 deletions

View file

@ -85,6 +85,9 @@ class TodoistTodoListEntity(CoordinatorEntity[TodoistCoordinator], TodoListEntit
for task in self.coordinator.data:
if task.project_id != self._project_id:
continue
if task.parent_id is not None:
# Filter out sub-tasks until they are supported by the UI.
continue
if task.is_completed:
status = TodoItemStatus.COMPLETED
else:

View file

@ -46,6 +46,7 @@ def make_api_task(
due: Due | None = None,
project_id: str | None = None,
description: str | None = None,
parent_id: str | None = None,
) -> Task:
"""Mock a todoist Task instance."""
return Task(
@ -61,7 +62,7 @@ def make_api_task(
id=id or "1",
labels=["Label1"],
order=1,
parent_id=None,
parent_id=parent_id,
priority=1,
project_id=project_id or PROJECT_ID,
section_id=None,

View file

@ -51,6 +51,14 @@ def set_time_zone(hass: HomeAssistant) -> None:
],
"0",
),
(
[
make_api_task(
id="12345", content="sub-task", is_completed=False, parent_id="1"
)
],
"0",
),
],
)
async def test_todo_item_state(