test: follow declared application version in backup names

This commit is contained in:
jxxghp
2026-09-14 16:57:35 +08:00
parent f6e8c59ca1
commit 2dedd00db4

View File

@@ -16,6 +16,7 @@ from app.application.backup import (
DatabaseBackupInProgressError,
DatabaseBackupService,
)
from version import APP_VERSION
@dataclass(frozen=True, slots=True)
@@ -99,7 +100,7 @@ def test_service_builds_artifact_store_from_current_policy_root(tmp_path: Path)
def test_create_publishes_one_readable_private_file(tmp_path: Path) -> None:
artifact = _service(tmp_path).create()
assert artifact.name == "moviepilot_v3.0.1_sqlite_20260819_134526.db"
assert artifact.name == f"moviepilot_{APP_VERSION}_sqlite_20260819_134526.db"
assert artifact.path.read_bytes() == b"database snapshot"
assert stat.S_IMODE(tmp_path.stat().st_mode) == 0o700
assert stat.S_IMODE(artifact.path.stat().st_mode) == 0o600
@@ -138,8 +139,8 @@ def test_same_second_backups_receive_short_sequence_suffix(tmp_path: Path) -> No
first = service.create()
second = service.create()
assert first.name == "moviepilot_v3.0.1_sqlite_20260819_134526.db"
assert second.name == "moviepilot_v3.0.1_sqlite_20260819_134526_1.db"
assert first.name == f"moviepilot_{APP_VERSION}_sqlite_20260819_134526.db"
assert second.name == f"moviepilot_{APP_VERSION}_sqlite_20260819_134526_1.db"
def test_backup_name_uses_application_release_version(