mirror of
https://github.com/mealie-recipes/mealie.git
synced 2026-02-25 17:23:11 -05:00
add migration data/test
This commit is contained in:
@@ -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"""
|
||||
|
||||
|
||||
BIN
tests/data/backups/backup-version-1d9a002d7234-1.zip
Normal file
BIN
tests/data/backups/backup-version-1d9a002d7234-1.zip
Normal file
Binary file not shown.
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user