From 0fc4ff9c7521132c8d45ad03bdddd4975281dce0 Mon Sep 17 00:00:00 2001 From: Michael Genson Date: Sun, 22 Feb 2026 20:12:01 +0000 Subject: [PATCH] add migration data/test --- tests/data/__init__.py | 3 +++ .../backups/backup-version-1d9a002d7234-1.zip | Bin 0 -> 6649 bytes .../backup_v2_tests/test_backup_v2.py | 18 ++++++++++++++++++ 3 files changed, 21 insertions(+) create mode 100644 tests/data/backups/backup-version-1d9a002d7234-1.zip diff --git a/tests/data/__init__.py b/tests/data/__init__.py index 92c81ab68..dc23abb4a 100644 --- a/tests/data/__init__.py +++ b/tests/data/__init__.py @@ -4,6 +4,9 @@ CWD = Path(__file__).parent locale_dir = CWD / "locale" +backup_version_1d9a002d7234_1 = CWD / "backups/backup-version-1d9a002d7234-1.zip" +"""1d9a002d7234: add referenced_recipe to ingredients""" + backup_version_44e8d670719d_1 = CWD / "backups/backup-version-44e8d670719d-1.zip" """44e8d670719d: add extras to shopping lists, list items, and ingredient foods""" diff --git a/tests/data/backups/backup-version-1d9a002d7234-1.zip b/tests/data/backups/backup-version-1d9a002d7234-1.zip new file mode 100644 index 0000000000000000000000000000000000000000..b3d64a555ebf7bf1988d22ef11a597fbcea7829a GIT binary patch literal 6649 zcmeHMOK;>h5_YmlZi~eNx#VUv<~V7K)Z3?wJ&woi@!RvjB!NItR5#s{sOZt{aWKIC zjy>fk`JzA1I={7Kj1Q<8$wyKIn7VE2G6?K06udlw{l0R>MfBmy>J}v+A-PV@; z{Ws78QV^fyY^52QN7 z2u+MgsAHcPrjLnf1-juN+q5l*`BX|KBxX|fg@A8(&ZBZFpJ(z}EjMG7r%bI^uD;B{ zSdaiq*DW56vF19CyTRfsQP)^4-on0X=*S6OgBU)e#IdZ<4h%aqFxE^uCif}Am)h_XEEWCG>$6KnEk+RNt{M(OhqgOQj+IOk*Uplg8e55KRG@2 zU!T3D`K#GJ$G`67%NN+)FK?olA78x>kEd_6ovD)_?z}ySZlV`DVec;VvD8(~y1QLu zB~yhB+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U;u?ZRF6w%wK;aMZSd39ei^T+S>XP D&?o&r literal 0 HcmV?d00001 diff --git a/tests/unit_tests/services_tests/backup_v2_tests/test_backup_v2.py b/tests/unit_tests/services_tests/backup_v2_tests/test_backup_v2.py index 754b632fa..22f25d33d 100644 --- a/tests/unit_tests/services_tests/backup_v2_tests/test_backup_v2.py +++ b/tests/unit_tests/services_tests/backup_v2_tests/test_backup_v2.py @@ -217,6 +217,22 @@ def _b9e516e2d3b3_add_household_to_recipe_last_made_household_to_foods_and_tools assert not tool.households_with_tool +def _a39c7f1826e3_add_unit_standardization_fields(session: Session): + groups = session.query(Group).all() + + for group in groups: + # test_data.backup_version_1d9a002d7234_1 has a non-anonymized "pint" unit + # and has not yet run the standardization migration. + pint_units = ( + session.query(IngredientUnitModel) + .filter(IngredientUnitModel.group_id == group.id, IngredientUnitModel.name == "pint") + .all() + ) + for unit in pint_units: + assert unit.standard_quantity == 2 + assert unit.standard_unit == "cup" + + def test_database_restore_data(): """ This tests real user backups to make sure the data is restored correctly. The data has been anonymized, but @@ -227,6 +243,7 @@ def test_database_restore_data(): """ backup_paths = [ + test_data.backup_version_1d9a002d7234_1, test_data.backup_version_44e8d670719d_1, test_data.backup_version_44e8d670719d_2, test_data.backup_version_44e8d670719d_3, @@ -245,6 +262,7 @@ def test_database_restore_data(): _d7c6efd2de42_migrate_favorites_and_ratings_to_user_ratings, _86054b40fd06_added_query_filter_string_to_cookbook_and_mealplan, _b9e516e2d3b3_add_household_to_recipe_last_made_household_to_foods_and_tools, + _a39c7f1826e3_add_unit_standardization_fields, ] settings = get_app_settings()