From b787c2617b97e607e5ae6f107e0ae5ec2c463082 Mon Sep 17 00:00:00 2001 From: "Mr. Bubbles" Date: Thu, 19 Sep 2024 10:59:54 +0200 Subject: [PATCH] Revert "Fix missing id in Habitica completed todos API response" (#126142) Revert "Fix missing id in Habitica completed todos API response (#124565)" This reverts commit c9e7c76ee55c628e59c659bd331ab6bf0352bed6. --- .../components/habitica/coordinator.py | 9 +----- tests/components/habitica/test_init.py | 28 +++++++++---------- 2 files changed, 15 insertions(+), 22 deletions(-) diff --git a/homeassistant/components/habitica/coordinator.py b/homeassistant/components/habitica/coordinator.py index 357643593e4..4e949b703fb 100644 --- a/homeassistant/components/habitica/coordinator.py +++ b/homeassistant/components/habitica/coordinator.py @@ -56,14 +56,7 @@ class HabiticaDataUpdateCoordinator(DataUpdateCoordinator[HabiticaData]): try: user_response = await self.api.user.get() tasks_response = await self.api.tasks.user.get() - tasks_response.extend( - [ - {"id": task["_id"], **task} - for task in await self.api.tasks.user.get(type="completedTodos") - if task.get("_id") - ] - ) - + tasks_response.extend(await self.api.tasks.user.get(type="completedTodos")) except ClientResponseError as error: if error.status == HTTPStatus.TOO_MANY_REQUESTS: _LOGGER.debug("Currently rate limited, skipping update") diff --git a/tests/components/habitica/test_init.py b/tests/components/habitica/test_init.py index 56f17bc9889..683472a720f 100644 --- a/tests/components/habitica/test_init.py +++ b/tests/components/habitica/test_init.py @@ -74,20 +74,7 @@ def common_requests(aioclient_mock: AiohttpClientMocker) -> AiohttpClientMocker: } }, ) - aioclient_mock.get( - "https://habitica.com/api/v3/tasks/user?type=completedTodos", - json={ - "data": [ - { - "text": "this is a mock todo #5", - "id": 5, - "_id": 5, - "type": "todo", - "completed": True, - } - ] - }, - ) + aioclient_mock.get( "https://habitica.com/api/v3/tasks/user", json={ @@ -102,6 +89,19 @@ def common_requests(aioclient_mock: AiohttpClientMocker) -> AiohttpClientMocker: ] }, ) + aioclient_mock.get( + "https://habitica.com/api/v3/tasks/user?type=completedTodos", + json={ + "data": [ + { + "text": "this is a mock todo #5", + "id": 5, + "type": "todo", + "completed": True, + } + ] + }, + ) aioclient_mock.post( "https://habitica.com/api/v3/tasks/user",