test_restore_project_values.py 783 B

12345678910111213141516171819
  1. """Restoring a SQLite backup onto PostgreSQL gives old projects a valid priority and status.
  2. Older versions stored any project priority or status; one longer than the
  3. column made PostgreSQL refuse the row and the whole restore failed (measured
  4. end to end against a throwaway PostgreSQL when this was written).
  5. """
  6. from backend.app.api.routes.settings import _restored_value_fixes
  7. from backend.app.models.project import PROJECT_PRIORITIES, PROJECT_STATUSES
  8. def test_projects_fall_back_like_import_and_the_start_up_repair():
  9. fixes = _restored_value_fixes("projects")
  10. assert fixes == {"priority": (PROJECT_PRIORITIES, "normal"), "status": (PROJECT_STATUSES, "active")}
  11. def test_other_tables_are_copied_as_they_are():
  12. assert _restored_value_fixes("print_queue") == {}