From 2d67b83b582b13e23a583a8c8d8aa59d2d4c88b9 Mon Sep 17 00:00:00 2001 From: Michael Genson <71845777+michael-genson@users.noreply.github.com> Date: Wed, 25 Nov 2026 14:58:35 -0600 Subject: [PATCH] fix: remove dependency on translation value for test (#9264) --- AGENTS.md | 1 + .../user_household_tests/test_group_mealplan_ical.py | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/AGENTS.md b/AGENTS.md index c994ec56f..be169f054 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -130,6 +130,7 @@ mise run docker:prod # Build and run production Docker compose - Fixtures in `tests/fixtures/` - Use `api_client` fixture for integration tests - Follow existing patterns in `tests/integration_tests/` and `tests/unit_tests/` + - Never hardcode non-English translated strings in assertions; Crowdin can change them at any time. Read the expected value with `get_all_translations(key)[locale]` (`mealie/lang/providers.py`) and assert it differs from the English string ### Frontend diff --git a/tests/integration_tests/user_household_tests/test_group_mealplan_ical.py b/tests/integration_tests/user_household_tests/test_group_mealplan_ical.py index f68ddadb5..3ae0b4874 100644 --- a/tests/integration_tests/user_household_tests/test_group_mealplan_ical.py +++ b/tests/integration_tests/user_household_tests/test_group_mealplan_ical.py @@ -4,6 +4,7 @@ from uuid import UUID from fastapi.testclient import TestClient from mealie.core.config import get_app_settings +from mealie.lang.providers import get_all_translations from mealie.schema.household.household_preferences import HouseholdPreferencesUpdate from mealie.schema.meal_plan.new_meal import PlanEntryCreate from mealie.schema.recipe.recipe import RecipeDraft @@ -158,7 +159,11 @@ def test_ical_feed_lang(api_client: TestClient, unique_user_fn_scoped: TestUser) create_entry(api_client, user, date=JULY_1, entry_type="dinner", title=random_string()) token = enable_feed(api_client, user) - assert "SUMMARY:Essen: " in unfold(get_feed(api_client, token, {"lang": "de-DE"}).text) + # read the German string from the locale file, since Crowdin owns its exact wording + expected_de = get_all_translations("mealplan.entry-type.dinner")["de-DE"] + assert expected_de != "Dinner" + + assert f"SUMMARY:{expected_de}: " in unfold(get_feed(api_client, token, {"lang": "de-DE"}).text) # unknown locales fall back to English assert "SUMMARY:Dinner: " in unfold(get_feed(api_client, token, {"lang": "xx-XX"}).text)