From e6715fd4d7fa758418d6213c423c4dfa949ee5e0 Mon Sep 17 00:00:00 2001 From: Manu <4445816+tr4nt0r@users.noreply.github.com> Date: Sat, 23 Nov 2024 19:44:40 +0100 Subject: [PATCH] Fix errors in fixtures and tests (#131388) * Fix errors in fixtures and tests * stale function name --- .../fixtures/common_buttons_unavailable.json | 5 +++-- .../habitica/fixtures/healer_fixture.json | 7 ++++--- .../fixtures/healer_skills_unavailable.json | 7 ++++--- .../fixtures/quest_invitation_off.json | 1 + .../habitica/fixtures/rogue_fixture.json | 7 ++++--- .../fixtures/rogue_skills_unavailable.json | 7 ++++--- .../fixtures/rogue_stealth_unavailable.json | 7 ++++--- tests/components/habitica/fixtures/user.json | 10 +++++---- .../habitica/fixtures/warrior_fixture.json | 7 ++++--- .../fixtures/warrior_skills_unavailable.json | 7 ++++--- .../habitica/fixtures/wizard_fixture.json | 7 ++++--- .../fixtures/wizard_frost_unavailable.json | 7 ++++--- .../fixtures/wizard_skills_unavailable.json | 7 ++++--- .../habitica/snapshots/test_sensor.ambr | 16 +++++++------- tests/components/habitica/test_todo.py | 21 +++++++------------ 15 files changed, 66 insertions(+), 57 deletions(-) diff --git a/tests/components/habitica/fixtures/common_buttons_unavailable.json b/tests/components/habitica/fixtures/common_buttons_unavailable.json index efee5364e02..bcc65ee3f91 100644 --- a/tests/components/habitica/fixtures/common_buttons_unavailable.json +++ b/tests/components/habitica/fixtures/common_buttons_unavailable.json @@ -1,4 +1,5 @@ { + "success": true, "data": { "api_user": "test-api-user", "profile": { "name": "test-user" }, @@ -45,8 +46,8 @@ "shield": "shield_warrior_5", "back": "heroicAureole", "headAccessory": "headAccessory_armoire_gogglesOfBookbinding", - "eyewear": "plagueDoctorMask", - "body": "aetherAmulet" + "eyewear": "eyewear_armoire_plagueDoctorMask", + "body": "body_special_aetherAmulet" } } } diff --git a/tests/components/habitica/fixtures/healer_fixture.json b/tests/components/habitica/fixtures/healer_fixture.json index 85f719f4ca7..d76ae612662 100644 --- a/tests/components/habitica/fixtures/healer_fixture.json +++ b/tests/components/habitica/fixtures/healer_fixture.json @@ -1,4 +1,5 @@ { + "success": true, "data": { "api_user": "test-api-user", "profile": { "name": "test-user" }, @@ -48,10 +49,10 @@ "armor": "armor_healer_5", "head": "head_healer_5", "shield": "shield_healer_5", - "back": "heroicAureole", + "back": "back_special_heroicAureole", "headAccessory": "headAccessory_armoire_gogglesOfBookbinding", - "eyewear": "plagueDoctorMask", - "body": "aetherAmulet" + "eyewear": "eyewear_armoire_plagueDoctorMask", + "body": "body_special_aetherAmulet" } } } diff --git a/tests/components/habitica/fixtures/healer_skills_unavailable.json b/tests/components/habitica/fixtures/healer_skills_unavailable.json index a6bff246b2a..e3cead40f7d 100644 --- a/tests/components/habitica/fixtures/healer_skills_unavailable.json +++ b/tests/components/habitica/fixtures/healer_skills_unavailable.json @@ -1,4 +1,5 @@ { + "success": true, "data": { "api_user": "test-api-user", "profile": { "name": "test-user" }, @@ -47,10 +48,10 @@ "armor": "armor_healer_5", "head": "head_healer_5", "shield": "shield_healer_5", - "back": "heroicAureole", + "back": "back_special_heroicAureole", "headAccessory": "headAccessory_armoire_gogglesOfBookbinding", - "eyewear": "plagueDoctorMask", - "body": "aetherAmulet" + "eyewear": "eyewear_armoire_plagueDoctorMask", + "body": "body_special_aetherAmulet" } } } diff --git a/tests/components/habitica/fixtures/quest_invitation_off.json b/tests/components/habitica/fixtures/quest_invitation_off.json index b5eccd99e10..0f191696476 100644 --- a/tests/components/habitica/fixtures/quest_invitation_off.json +++ b/tests/components/habitica/fixtures/quest_invitation_off.json @@ -1,4 +1,5 @@ { + "success": true, "data": { "api_user": "test-api-user", "profile": { "name": "test-user" }, diff --git a/tests/components/habitica/fixtures/rogue_fixture.json b/tests/components/habitica/fixtures/rogue_fixture.json index 1e5e996c034..b6fcd9f1427 100644 --- a/tests/components/habitica/fixtures/rogue_fixture.json +++ b/tests/components/habitica/fixtures/rogue_fixture.json @@ -1,4 +1,5 @@ { + "success": true, "data": { "api_user": "test-api-user", "profile": { "name": "test-user" }, @@ -48,10 +49,10 @@ "armor": "armor_rogue_5", "head": "head_rogue_5", "shield": "shield_rogue_5", - "back": "heroicAureole", + "back": "back_special_heroicAureole", "headAccessory": "headAccessory_armoire_gogglesOfBookbinding", - "eyewear": "plagueDoctorMask", - "body": "aetherAmulet" + "eyewear": "eyewear_armoire_plagueDoctorMask", + "body": "body_special_aetherAmulet" } } } diff --git a/tests/components/habitica/fixtures/rogue_skills_unavailable.json b/tests/components/habitica/fixtures/rogue_skills_unavailable.json index c7c5ff32245..b3bada649fa 100644 --- a/tests/components/habitica/fixtures/rogue_skills_unavailable.json +++ b/tests/components/habitica/fixtures/rogue_skills_unavailable.json @@ -1,4 +1,5 @@ { + "success": true, "data": { "api_user": "test-api-user", "profile": { "name": "test-user" }, @@ -47,10 +48,10 @@ "armor": "armor_rogue_5", "head": "head_rogue_5", "shield": "shield_rogue_5", - "back": "heroicAureole", + "back": "back_special_heroicAureole", "headAccessory": "headAccessory_armoire_gogglesOfBookbinding", - "eyewear": "plagueDoctorMask", - "body": "aetherAmulet" + "eyewear": "eyewear_armoire_plagueDoctorMask", + "body": "body_special_aetherAmulet" } } } diff --git a/tests/components/habitica/fixtures/rogue_stealth_unavailable.json b/tests/components/habitica/fixtures/rogue_stealth_unavailable.json index 9fd7adcca42..9478feb91fa 100644 --- a/tests/components/habitica/fixtures/rogue_stealth_unavailable.json +++ b/tests/components/habitica/fixtures/rogue_stealth_unavailable.json @@ -1,4 +1,5 @@ { + "success": true, "data": { "api_user": "test-api-user", "profile": { "name": "test-user" }, @@ -47,10 +48,10 @@ "armor": "armor_rogue_5", "head": "head_rogue_5", "shield": "shield_rogue_5", - "back": "heroicAureole", + "back": "back_special_heroicAureole", "headAccessory": "headAccessory_armoire_gogglesOfBookbinding", - "eyewear": "plagueDoctorMask", - "body": "aetherAmulet" + "eyewear": "eyewear_armoire_plagueDoctorMask", + "body": "body_special_aetherAmulet" } } } diff --git a/tests/components/habitica/fixtures/user.json b/tests/components/habitica/fixtures/user.json index e1b77cd31f2..a498de910ef 100644 --- a/tests/components/habitica/fixtures/user.json +++ b/tests/components/habitica/fixtures/user.json @@ -1,4 +1,5 @@ { + "success": true, "data": { "api_user": "test-api-user", "profile": { "name": "test-user" }, @@ -62,7 +63,8 @@ "quest": { "RSVPNeeded": true, "key": "dustbunnies" - } + }, + "_id": "94cd398c-2240-4320-956e-6d345cf2c0de" }, "needsCron": true, "lastCron": "2024-09-21T22:01:55.586Z", @@ -74,10 +76,10 @@ "armor": "armor_warrior_5", "head": "head_warrior_5", "shield": "shield_warrior_5", - "back": "heroicAureole", + "back": "back_special_heroicAureole", "headAccessory": "headAccessory_armoire_gogglesOfBookbinding", - "eyewear": "plagueDoctorMask", - "body": "aetherAmulet" + "eyewear": "eyewear_armoire_plagueDoctorMask", + "body": "body_special_aetherAmulet" } } } diff --git a/tests/components/habitica/fixtures/warrior_fixture.json b/tests/components/habitica/fixtures/warrior_fixture.json index 3517e8a908a..97ad9e5b060 100644 --- a/tests/components/habitica/fixtures/warrior_fixture.json +++ b/tests/components/habitica/fixtures/warrior_fixture.json @@ -1,4 +1,5 @@ { + "success": true, "data": { "api_user": "test-api-user", "profile": { "name": "test-user" }, @@ -48,10 +49,10 @@ "armor": "armor_warrior_5", "head": "head_warrior_5", "shield": "shield_warrior_5", - "back": "heroicAureole", + "back": "back_special_heroicAureole", "headAccessory": "headAccessory_armoire_gogglesOfBookbinding", - "eyewear": "plagueDoctorMask", - "body": "aetherAmulet" + "eyewear": "eyewear_armoire_plagueDoctorMask", + "body": "body_special_aetherAmulet" } } } diff --git a/tests/components/habitica/fixtures/warrior_skills_unavailable.json b/tests/components/habitica/fixtures/warrior_skills_unavailable.json index b3d33c85d5c..f25ca484cba 100644 --- a/tests/components/habitica/fixtures/warrior_skills_unavailable.json +++ b/tests/components/habitica/fixtures/warrior_skills_unavailable.json @@ -1,4 +1,5 @@ { + "success": true, "data": { "api_user": "test-api-user", "profile": { "name": "test-user" }, @@ -47,10 +48,10 @@ "armor": "armor_warrior_5", "head": "head_warrior_5", "shield": "shield_warrior_5", - "back": "heroicAureole", + "back": "back_special_heroicAureole", "headAccessory": "headAccessory_armoire_gogglesOfBookbinding", - "eyewear": "plagueDoctorMask", - "body": "aetherAmulet" + "eyewear": "eyewear_armoire_plagueDoctorMask", + "body": "body_special_aetherAmulet" } } } diff --git a/tests/components/habitica/fixtures/wizard_fixture.json b/tests/components/habitica/fixtures/wizard_fixture.json index de596e231de..655c0ad1f0d 100644 --- a/tests/components/habitica/fixtures/wizard_fixture.json +++ b/tests/components/habitica/fixtures/wizard_fixture.json @@ -1,4 +1,5 @@ { + "success": true, "data": { "api_user": "test-api-user", "profile": { "name": "test-user" }, @@ -48,10 +49,10 @@ "armor": "armor_wizard_5", "head": "head_wizard_5", "shield": "shield_base_0", - "back": "heroicAureole", + "back": "back_special_heroicAureole", "headAccessory": "headAccessory_armoire_gogglesOfBookbinding", - "eyewear": "plagueDoctorMask", - "body": "aetherAmulet" + "eyewear": "eyewear_armoire_plagueDoctorMask", + "body": "body_special_aetherAmulet" } } } diff --git a/tests/components/habitica/fixtures/wizard_frost_unavailable.json b/tests/components/habitica/fixtures/wizard_frost_unavailable.json index 31d10fde4b9..d5634633a0d 100644 --- a/tests/components/habitica/fixtures/wizard_frost_unavailable.json +++ b/tests/components/habitica/fixtures/wizard_frost_unavailable.json @@ -1,4 +1,5 @@ { + "success": true, "data": { "api_user": "test-api-user", "profile": { "name": "test-user" }, @@ -47,10 +48,10 @@ "armor": "armor_wizard_5", "head": "head_wizard_5", "shield": "shield_base_0", - "back": "heroicAureole", + "back": "back_special_heroicAureole", "headAccessory": "headAccessory_armoire_gogglesOfBookbinding", - "eyewear": "plagueDoctorMask", - "body": "aetherAmulet" + "eyewear": "eyewear_armoire_plagueDoctorMask", + "body": "body_special_aetherAmulet" } } } diff --git a/tests/components/habitica/fixtures/wizard_skills_unavailable.json b/tests/components/habitica/fixtures/wizard_skills_unavailable.json index f3bdee9dd74..eaf5f6f55b8 100644 --- a/tests/components/habitica/fixtures/wizard_skills_unavailable.json +++ b/tests/components/habitica/fixtures/wizard_skills_unavailable.json @@ -1,4 +1,5 @@ { + "success": true, "data": { "api_user": "test-api-user", "profile": { "name": "test-user" }, @@ -47,10 +48,10 @@ "armor": "armor_wizard_5", "head": "head_wizard_5", "shield": "shield_base_0", - "back": "heroicAureole", + "back": "back_special_heroicAureole", "headAccessory": "headAccessory_armoire_gogglesOfBookbinding", - "eyewear": "plagueDoctorMask", - "body": "aetherAmulet" + "eyewear": "eyewear_armoire_plagueDoctorMask", + "body": "body_special_aetherAmulet" } } } diff --git a/tests/components/habitica/snapshots/test_sensor.ambr b/tests/components/habitica/snapshots/test_sensor.ambr index 07eddf496b2..250648a5572 100644 --- a/tests/components/habitica/snapshots/test_sensor.ambr +++ b/tests/components/habitica/snapshots/test_sensor.ambr @@ -101,7 +101,7 @@ 'allocated': 15, 'buffs': 26, 'class': 0, - 'equipment': 20, + 'equipment': 42, 'friendly_name': 'test-user Constitution', 'level': 19, 'unit_of_measurement': 'CON', @@ -111,7 +111,7 @@ 'last_changed': , 'last_reported': , 'last_updated': , - 'state': '80', + 'state': '102', }) # --- # name: test_sensors[sensor.test_user_dailies-entry] @@ -665,7 +665,7 @@ 'allocated': 15, 'buffs': 26, 'class': 0, - 'equipment': 0, + 'equipment': 12, 'friendly_name': 'test-user Intelligence', 'level': 19, 'unit_of_measurement': 'INT', @@ -675,7 +675,7 @@ 'last_changed': , 'last_reported': , 'last_updated': , - 'state': '60', + 'state': '72', }) # --- # name: test_sensors[sensor.test_user_level-entry] @@ -1007,7 +1007,7 @@ 'allocated': 15, 'buffs': 26, 'class': 0, - 'equipment': 8, + 'equipment': 15, 'friendly_name': 'test-user Perception', 'level': 19, 'unit_of_measurement': 'PER', @@ -1017,7 +1017,7 @@ 'last_changed': , 'last_reported': , 'last_updated': , - 'state': '68', + 'state': '75', }) # --- # name: test_sensors[sensor.test_user_rewards-entry] @@ -1123,7 +1123,7 @@ 'allocated': 15, 'buffs': 26, 'class': 0, - 'equipment': 27, + 'equipment': 44, 'friendly_name': 'test-user Strength', 'level': 19, 'unit_of_measurement': 'STR', @@ -1133,7 +1133,7 @@ 'last_changed': , 'last_reported': , 'last_updated': , - 'state': '87', + 'state': '104', }) # --- # name: test_sensors[sensor.test_user_to_do_s-entry] diff --git a/tests/components/habitica/test_todo.py b/tests/components/habitica/test_todo.py index c9a4b3dd37a..66f741eb39a 100644 --- a/tests/components/habitica/test_todo.py +++ b/tests/components/habitica/test_todo.py @@ -1,7 +1,6 @@ """Tests for Habitica todo platform.""" from collections.abc import Generator -from datetime import datetime from http import HTTPStatus import json import re @@ -39,7 +38,7 @@ from tests.typing import WebSocketGenerator @pytest.fixture(autouse=True) -def switch_only() -> Generator[None]: +def todo_only() -> Generator[None]: """Enable only the todo platform.""" with patch( "homeassistant.components.habitica.PLATFORMS", @@ -628,12 +627,12 @@ async def test_move_todo_item_exception( @pytest.mark.parametrize( ("fixture", "calculated_due_date"), [ - ("duedate_fixture_1.json", (2024, 9, 23)), - ("duedate_fixture_2.json", (2024, 9, 24)), - ("duedate_fixture_3.json", (2024, 10, 23)), - ("duedate_fixture_4.json", (2024, 10, 23)), - ("duedate_fixture_5.json", (2024, 9, 28)), - ("duedate_fixture_6.json", (2024, 10, 21)), + ("duedate_fixture_1.json", "2024-09-22"), + ("duedate_fixture_2.json", "2024-09-24"), + ("duedate_fixture_3.json", "2024-10-23"), + ("duedate_fixture_4.json", "2024-10-23"), + ("duedate_fixture_5.json", "2024-09-28"), + ("duedate_fixture_6.json", "2024-10-21"), ("duedate_fixture_7.json", None), ("duedate_fixture_8.json", None), ], @@ -693,8 +692,4 @@ async def test_next_due_date( return_response=True, ) - assert ( - result[dailies_entity]["items"][0].get("due") is None - if not calculated_due_date - else datetime(*calculated_due_date).date() - ) + assert result[dailies_entity]["items"][0].get("due") == calculated_due_date