Also add Kick to dataset

This commit is contained in:
Joakim Hellsén 2026-03-17 00:07:22 +01:00
commit 563266d8cc
Signed by: Joakim Hellsén
SSH key fingerprint: SHA256:/9h/CsExpFp+PRhsfA0xznFx2CGfTT5R/kpuFfUgEQk
3 changed files with 22 additions and 12 deletions

View file

@ -84,34 +84,39 @@ class TestBackupCommand:
assert "twitch_game" in content
assert "Test Org" in content
def test_backup_excludes_non_twitch_tables(self, tmp_path: Path) -> None:
"""Test that backup only includes twitch_ prefixed tables."""
def test_backup_excludes_non_app_tables(self, tmp_path: Path) -> None:
"""Test that backup includes app tables and excludes non-app tables."""
_skip_if_pg_dump_missing()
# Create test data so tables exist
Organization.objects.create(twitch_id="test001", name="Test Org")
output_dir = tmp_path / "backups"
output_dir: Path = tmp_path / "backups"
output_dir.mkdir()
call_command("backup_db", output_dir=str(output_dir), prefix="test")
backup_file = next(iter(output_dir.glob("test-*.sql.zst")))
backup_file: Path = next(iter(output_dir.glob("test-*.sql.zst")))
with (
backup_file.open("rb") as raw_handle,
zstd.open(raw_handle, "r") as compressed,
io.TextIOWrapper(compressed, encoding="utf-8") as handle,
):
content = handle.read()
content: str = handle.read()
# Should NOT contain django admin, silk, or debug toolbar tables
assert "django_session" not in content
assert "django_migrations" not in content
assert "django_content_type" not in content
assert "silk_" not in content
assert "debug_toolbar_" not in content
assert "django_admin_log" not in content
assert "auth_" not in content
assert "youtube_" not in content
# Should contain twitch tables
# Should contain twitch and kick tables
assert "twitch_" in content
assert "kick_" in content
def test_backup_with_custom_prefix(self, tmp_path: Path) -> None:
"""Test that custom prefix is used in filename."""