mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 01:08:12 +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 c9e7c76ee55c628e59c659bd331ab6bf0352bed6.
This commit is contained in:
parent
3c99fad6b9
commit
b787c2617b
@ -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")
|
||||
|
@ -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",
|
||||
|
Loading…
x
Reference in New Issue
Block a user