1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 21:06:19 +00:00

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 c9e7c76ee5.
This commit is contained in:
Mr. Bubbles
2024-09-19 10:59:54 +02:00
committed by GitHub
parent 3c99fad6b9
commit b787c2617b
2 changed files with 15 additions and 22 deletions

View File

@@ -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")

View File

@@ -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",