Fix errors in fixtures and tests (#131388)

* Fix errors in fixtures and tests

* stale function name
This commit is contained in:
Manu 2024-11-23 19:44:40 +01:00 committed by GitHub
parent c7485b94d5
commit e6715fd4d7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
15 changed files with 66 additions and 57 deletions

View File

@ -1,4 +1,5 @@
{ {
"success": true,
"data": { "data": {
"api_user": "test-api-user", "api_user": "test-api-user",
"profile": { "name": "test-user" }, "profile": { "name": "test-user" },
@ -45,8 +46,8 @@
"shield": "shield_warrior_5", "shield": "shield_warrior_5",
"back": "heroicAureole", "back": "heroicAureole",
"headAccessory": "headAccessory_armoire_gogglesOfBookbinding", "headAccessory": "headAccessory_armoire_gogglesOfBookbinding",
"eyewear": "plagueDoctorMask", "eyewear": "eyewear_armoire_plagueDoctorMask",
"body": "aetherAmulet" "body": "body_special_aetherAmulet"
} }
} }
} }

View File

@ -1,4 +1,5 @@
{ {
"success": true,
"data": { "data": {
"api_user": "test-api-user", "api_user": "test-api-user",
"profile": { "name": "test-user" }, "profile": { "name": "test-user" },
@ -48,10 +49,10 @@
"armor": "armor_healer_5", "armor": "armor_healer_5",
"head": "head_healer_5", "head": "head_healer_5",
"shield": "shield_healer_5", "shield": "shield_healer_5",
"back": "heroicAureole", "back": "back_special_heroicAureole",
"headAccessory": "headAccessory_armoire_gogglesOfBookbinding", "headAccessory": "headAccessory_armoire_gogglesOfBookbinding",
"eyewear": "plagueDoctorMask", "eyewear": "eyewear_armoire_plagueDoctorMask",
"body": "aetherAmulet" "body": "body_special_aetherAmulet"
} }
} }
} }

View File

@ -1,4 +1,5 @@
{ {
"success": true,
"data": { "data": {
"api_user": "test-api-user", "api_user": "test-api-user",
"profile": { "name": "test-user" }, "profile": { "name": "test-user" },
@ -47,10 +48,10 @@
"armor": "armor_healer_5", "armor": "armor_healer_5",
"head": "head_healer_5", "head": "head_healer_5",
"shield": "shield_healer_5", "shield": "shield_healer_5",
"back": "heroicAureole", "back": "back_special_heroicAureole",
"headAccessory": "headAccessory_armoire_gogglesOfBookbinding", "headAccessory": "headAccessory_armoire_gogglesOfBookbinding",
"eyewear": "plagueDoctorMask", "eyewear": "eyewear_armoire_plagueDoctorMask",
"body": "aetherAmulet" "body": "body_special_aetherAmulet"
} }
} }
} }

View File

@ -1,4 +1,5 @@
{ {
"success": true,
"data": { "data": {
"api_user": "test-api-user", "api_user": "test-api-user",
"profile": { "name": "test-user" }, "profile": { "name": "test-user" },

View File

@ -1,4 +1,5 @@
{ {
"success": true,
"data": { "data": {
"api_user": "test-api-user", "api_user": "test-api-user",
"profile": { "name": "test-user" }, "profile": { "name": "test-user" },
@ -48,10 +49,10 @@
"armor": "armor_rogue_5", "armor": "armor_rogue_5",
"head": "head_rogue_5", "head": "head_rogue_5",
"shield": "shield_rogue_5", "shield": "shield_rogue_5",
"back": "heroicAureole", "back": "back_special_heroicAureole",
"headAccessory": "headAccessory_armoire_gogglesOfBookbinding", "headAccessory": "headAccessory_armoire_gogglesOfBookbinding",
"eyewear": "plagueDoctorMask", "eyewear": "eyewear_armoire_plagueDoctorMask",
"body": "aetherAmulet" "body": "body_special_aetherAmulet"
} }
} }
} }

View File

@ -1,4 +1,5 @@
{ {
"success": true,
"data": { "data": {
"api_user": "test-api-user", "api_user": "test-api-user",
"profile": { "name": "test-user" }, "profile": { "name": "test-user" },
@ -47,10 +48,10 @@
"armor": "armor_rogue_5", "armor": "armor_rogue_5",
"head": "head_rogue_5", "head": "head_rogue_5",
"shield": "shield_rogue_5", "shield": "shield_rogue_5",
"back": "heroicAureole", "back": "back_special_heroicAureole",
"headAccessory": "headAccessory_armoire_gogglesOfBookbinding", "headAccessory": "headAccessory_armoire_gogglesOfBookbinding",
"eyewear": "plagueDoctorMask", "eyewear": "eyewear_armoire_plagueDoctorMask",
"body": "aetherAmulet" "body": "body_special_aetherAmulet"
} }
} }
} }

View File

@ -1,4 +1,5 @@
{ {
"success": true,
"data": { "data": {
"api_user": "test-api-user", "api_user": "test-api-user",
"profile": { "name": "test-user" }, "profile": { "name": "test-user" },
@ -47,10 +48,10 @@
"armor": "armor_rogue_5", "armor": "armor_rogue_5",
"head": "head_rogue_5", "head": "head_rogue_5",
"shield": "shield_rogue_5", "shield": "shield_rogue_5",
"back": "heroicAureole", "back": "back_special_heroicAureole",
"headAccessory": "headAccessory_armoire_gogglesOfBookbinding", "headAccessory": "headAccessory_armoire_gogglesOfBookbinding",
"eyewear": "plagueDoctorMask", "eyewear": "eyewear_armoire_plagueDoctorMask",
"body": "aetherAmulet" "body": "body_special_aetherAmulet"
} }
} }
} }

View File

@ -1,4 +1,5 @@
{ {
"success": true,
"data": { "data": {
"api_user": "test-api-user", "api_user": "test-api-user",
"profile": { "name": "test-user" }, "profile": { "name": "test-user" },
@ -62,7 +63,8 @@
"quest": { "quest": {
"RSVPNeeded": true, "RSVPNeeded": true,
"key": "dustbunnies" "key": "dustbunnies"
} },
"_id": "94cd398c-2240-4320-956e-6d345cf2c0de"
}, },
"needsCron": true, "needsCron": true,
"lastCron": "2024-09-21T22:01:55.586Z", "lastCron": "2024-09-21T22:01:55.586Z",
@ -74,10 +76,10 @@
"armor": "armor_warrior_5", "armor": "armor_warrior_5",
"head": "head_warrior_5", "head": "head_warrior_5",
"shield": "shield_warrior_5", "shield": "shield_warrior_5",
"back": "heroicAureole", "back": "back_special_heroicAureole",
"headAccessory": "headAccessory_armoire_gogglesOfBookbinding", "headAccessory": "headAccessory_armoire_gogglesOfBookbinding",
"eyewear": "plagueDoctorMask", "eyewear": "eyewear_armoire_plagueDoctorMask",
"body": "aetherAmulet" "body": "body_special_aetherAmulet"
} }
} }
} }

View File

@ -1,4 +1,5 @@
{ {
"success": true,
"data": { "data": {
"api_user": "test-api-user", "api_user": "test-api-user",
"profile": { "name": "test-user" }, "profile": { "name": "test-user" },
@ -48,10 +49,10 @@
"armor": "armor_warrior_5", "armor": "armor_warrior_5",
"head": "head_warrior_5", "head": "head_warrior_5",
"shield": "shield_warrior_5", "shield": "shield_warrior_5",
"back": "heroicAureole", "back": "back_special_heroicAureole",
"headAccessory": "headAccessory_armoire_gogglesOfBookbinding", "headAccessory": "headAccessory_armoire_gogglesOfBookbinding",
"eyewear": "plagueDoctorMask", "eyewear": "eyewear_armoire_plagueDoctorMask",
"body": "aetherAmulet" "body": "body_special_aetherAmulet"
} }
} }
} }

View File

@ -1,4 +1,5 @@
{ {
"success": true,
"data": { "data": {
"api_user": "test-api-user", "api_user": "test-api-user",
"profile": { "name": "test-user" }, "profile": { "name": "test-user" },
@ -47,10 +48,10 @@
"armor": "armor_warrior_5", "armor": "armor_warrior_5",
"head": "head_warrior_5", "head": "head_warrior_5",
"shield": "shield_warrior_5", "shield": "shield_warrior_5",
"back": "heroicAureole", "back": "back_special_heroicAureole",
"headAccessory": "headAccessory_armoire_gogglesOfBookbinding", "headAccessory": "headAccessory_armoire_gogglesOfBookbinding",
"eyewear": "plagueDoctorMask", "eyewear": "eyewear_armoire_plagueDoctorMask",
"body": "aetherAmulet" "body": "body_special_aetherAmulet"
} }
} }
} }

View File

@ -1,4 +1,5 @@
{ {
"success": true,
"data": { "data": {
"api_user": "test-api-user", "api_user": "test-api-user",
"profile": { "name": "test-user" }, "profile": { "name": "test-user" },
@ -48,10 +49,10 @@
"armor": "armor_wizard_5", "armor": "armor_wizard_5",
"head": "head_wizard_5", "head": "head_wizard_5",
"shield": "shield_base_0", "shield": "shield_base_0",
"back": "heroicAureole", "back": "back_special_heroicAureole",
"headAccessory": "headAccessory_armoire_gogglesOfBookbinding", "headAccessory": "headAccessory_armoire_gogglesOfBookbinding",
"eyewear": "plagueDoctorMask", "eyewear": "eyewear_armoire_plagueDoctorMask",
"body": "aetherAmulet" "body": "body_special_aetherAmulet"
} }
} }
} }

View File

@ -1,4 +1,5 @@
{ {
"success": true,
"data": { "data": {
"api_user": "test-api-user", "api_user": "test-api-user",
"profile": { "name": "test-user" }, "profile": { "name": "test-user" },
@ -47,10 +48,10 @@
"armor": "armor_wizard_5", "armor": "armor_wizard_5",
"head": "head_wizard_5", "head": "head_wizard_5",
"shield": "shield_base_0", "shield": "shield_base_0",
"back": "heroicAureole", "back": "back_special_heroicAureole",
"headAccessory": "headAccessory_armoire_gogglesOfBookbinding", "headAccessory": "headAccessory_armoire_gogglesOfBookbinding",
"eyewear": "plagueDoctorMask", "eyewear": "eyewear_armoire_plagueDoctorMask",
"body": "aetherAmulet" "body": "body_special_aetherAmulet"
} }
} }
} }

View File

@ -1,4 +1,5 @@
{ {
"success": true,
"data": { "data": {
"api_user": "test-api-user", "api_user": "test-api-user",
"profile": { "name": "test-user" }, "profile": { "name": "test-user" },
@ -47,10 +48,10 @@
"armor": "armor_wizard_5", "armor": "armor_wizard_5",
"head": "head_wizard_5", "head": "head_wizard_5",
"shield": "shield_base_0", "shield": "shield_base_0",
"back": "heroicAureole", "back": "back_special_heroicAureole",
"headAccessory": "headAccessory_armoire_gogglesOfBookbinding", "headAccessory": "headAccessory_armoire_gogglesOfBookbinding",
"eyewear": "plagueDoctorMask", "eyewear": "eyewear_armoire_plagueDoctorMask",
"body": "aetherAmulet" "body": "body_special_aetherAmulet"
} }
} }
} }

View File

@ -101,7 +101,7 @@
'allocated': 15, 'allocated': 15,
'buffs': 26, 'buffs': 26,
'class': 0, 'class': 0,
'equipment': 20, 'equipment': 42,
'friendly_name': 'test-user Constitution', 'friendly_name': 'test-user Constitution',
'level': 19, 'level': 19,
'unit_of_measurement': 'CON', 'unit_of_measurement': 'CON',
@ -111,7 +111,7 @@
'last_changed': <ANY>, 'last_changed': <ANY>,
'last_reported': <ANY>, 'last_reported': <ANY>,
'last_updated': <ANY>, 'last_updated': <ANY>,
'state': '80', 'state': '102',
}) })
# --- # ---
# name: test_sensors[sensor.test_user_dailies-entry] # name: test_sensors[sensor.test_user_dailies-entry]
@ -665,7 +665,7 @@
'allocated': 15, 'allocated': 15,
'buffs': 26, 'buffs': 26,
'class': 0, 'class': 0,
'equipment': 0, 'equipment': 12,
'friendly_name': 'test-user Intelligence', 'friendly_name': 'test-user Intelligence',
'level': 19, 'level': 19,
'unit_of_measurement': 'INT', 'unit_of_measurement': 'INT',
@ -675,7 +675,7 @@
'last_changed': <ANY>, 'last_changed': <ANY>,
'last_reported': <ANY>, 'last_reported': <ANY>,
'last_updated': <ANY>, 'last_updated': <ANY>,
'state': '60', 'state': '72',
}) })
# --- # ---
# name: test_sensors[sensor.test_user_level-entry] # name: test_sensors[sensor.test_user_level-entry]
@ -1007,7 +1007,7 @@
'allocated': 15, 'allocated': 15,
'buffs': 26, 'buffs': 26,
'class': 0, 'class': 0,
'equipment': 8, 'equipment': 15,
'friendly_name': 'test-user Perception', 'friendly_name': 'test-user Perception',
'level': 19, 'level': 19,
'unit_of_measurement': 'PER', 'unit_of_measurement': 'PER',
@ -1017,7 +1017,7 @@
'last_changed': <ANY>, 'last_changed': <ANY>,
'last_reported': <ANY>, 'last_reported': <ANY>,
'last_updated': <ANY>, 'last_updated': <ANY>,
'state': '68', 'state': '75',
}) })
# --- # ---
# name: test_sensors[sensor.test_user_rewards-entry] # name: test_sensors[sensor.test_user_rewards-entry]
@ -1123,7 +1123,7 @@
'allocated': 15, 'allocated': 15,
'buffs': 26, 'buffs': 26,
'class': 0, 'class': 0,
'equipment': 27, 'equipment': 44,
'friendly_name': 'test-user Strength', 'friendly_name': 'test-user Strength',
'level': 19, 'level': 19,
'unit_of_measurement': 'STR', 'unit_of_measurement': 'STR',
@ -1133,7 +1133,7 @@
'last_changed': <ANY>, 'last_changed': <ANY>,
'last_reported': <ANY>, 'last_reported': <ANY>,
'last_updated': <ANY>, 'last_updated': <ANY>,
'state': '87', 'state': '104',
}) })
# --- # ---
# name: test_sensors[sensor.test_user_to_do_s-entry] # name: test_sensors[sensor.test_user_to_do_s-entry]

View File

@ -1,7 +1,6 @@
"""Tests for Habitica todo platform.""" """Tests for Habitica todo platform."""
from collections.abc import Generator from collections.abc import Generator
from datetime import datetime
from http import HTTPStatus from http import HTTPStatus
import json import json
import re import re
@ -39,7 +38,7 @@ from tests.typing import WebSocketGenerator
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
def switch_only() -> Generator[None]: def todo_only() -> Generator[None]:
"""Enable only the todo platform.""" """Enable only the todo platform."""
with patch( with patch(
"homeassistant.components.habitica.PLATFORMS", "homeassistant.components.habitica.PLATFORMS",
@ -628,12 +627,12 @@ async def test_move_todo_item_exception(
@pytest.mark.parametrize( @pytest.mark.parametrize(
("fixture", "calculated_due_date"), ("fixture", "calculated_due_date"),
[ [
("duedate_fixture_1.json", (2024, 9, 23)), ("duedate_fixture_1.json", "2024-09-22"),
("duedate_fixture_2.json", (2024, 9, 24)), ("duedate_fixture_2.json", "2024-09-24"),
("duedate_fixture_3.json", (2024, 10, 23)), ("duedate_fixture_3.json", "2024-10-23"),
("duedate_fixture_4.json", (2024, 10, 23)), ("duedate_fixture_4.json", "2024-10-23"),
("duedate_fixture_5.json", (2024, 9, 28)), ("duedate_fixture_5.json", "2024-09-28"),
("duedate_fixture_6.json", (2024, 10, 21)), ("duedate_fixture_6.json", "2024-10-21"),
("duedate_fixture_7.json", None), ("duedate_fixture_7.json", None),
("duedate_fixture_8.json", None), ("duedate_fixture_8.json", None),
], ],
@ -693,8 +692,4 @@ async def test_next_due_date(
return_response=True, return_response=True,
) )
assert ( assert result[dailies_entity]["items"][0].get("due") == calculated_due_date
result[dailies_entity]["items"][0].get("due") is None
if not calculated_due_date
else datetime(*calculated_due_date).date()
)