Skip to content

Commit

Permalink
Fix google_tasks todo tests (home-assistant#103098)
Browse files Browse the repository at this point in the history
  • Loading branch information
emontnemery authored and frenck committed Oct 31, 2023
1 parent abaeacb commit 957998e
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions tests/components/google_tasks/test_todo.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@
"items": [],
}

LIST_TASKS_RESPONSE_WATER = {
"items": [
{"id": "some-task-id", "title": "Water", "status": "needsAction"},
],
}


@pytest.fixture
def platforms() -> list[str]:
Expand Down Expand Up @@ -198,8 +204,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.my_tasks"},
blocking=True,
)
Expand All @@ -215,7 +221,7 @@ async def test_create_todo_list_item(
[
[
LIST_TASK_LIST_RESPONSE,
LIST_TASKS_RESPONSE,
LIST_TASKS_RESPONSE_WATER,
EMPTY_RESPONSE, # update
LIST_TASKS_RESPONSE, # refresh after update
]
Expand All @@ -234,12 +240,12 @@ async def test_update_todo_list_item(

state = hass.states.get("todo.my_tasks")
assert state
assert state.state == "0"
assert state.state == "1"

await hass.services.async_call(
TODO_DOMAIN,
"update_item",
{"uid": "some-task-id", "summary": "Soda", "status": "completed"},
{"item": "some-task-id", "rename": "Soda", "status": "completed"},
target={"entity_id": "todo.my_tasks"},
blocking=True,
)
Expand All @@ -255,7 +261,7 @@ async def test_update_todo_list_item(
[
[
LIST_TASK_LIST_RESPONSE,
LIST_TASKS_RESPONSE,
LIST_TASKS_RESPONSE_WATER,
EMPTY_RESPONSE, # update
LIST_TASKS_RESPONSE, # refresh after update
]
Expand All @@ -274,12 +280,12 @@ async def test_partial_update_title(

state = hass.states.get("todo.my_tasks")
assert state
assert state.state == "0"
assert state.state == "1"

await hass.services.async_call(
TODO_DOMAIN,
"update_item",
{"uid": "some-task-id", "summary": "Soda"},
{"item": "some-task-id", "rename": "Soda"},
target={"entity_id": "todo.my_tasks"},
blocking=True,
)
Expand All @@ -295,7 +301,7 @@ async def test_partial_update_title(
[
[
LIST_TASK_LIST_RESPONSE,
LIST_TASKS_RESPONSE,
LIST_TASKS_RESPONSE_WATER,
EMPTY_RESPONSE, # update
LIST_TASKS_RESPONSE, # refresh after update
]
Expand All @@ -314,12 +320,12 @@ async def test_partial_update_status(

state = hass.states.get("todo.my_tasks")
assert state
assert state.state == "0"
assert state.state == "1"

await hass.services.async_call(
TODO_DOMAIN,
"update_item",
{"uid": "some-task-id", "status": "needs_action"},
{"item": "some-task-id", "status": "needs_action"},
target={"entity_id": "todo.my_tasks"},
blocking=True,
)
Expand Down

0 comments on commit 957998e

Please sign in to comment.