import json import zipfile import pytest @pytest.fixture def manifest(): return { "format": "viano-bug-case-package", "format_version": 1, "package_id": "stable-package", "package_generation": 0, "case_id": "case-A", "project": {"type": "generic", "profile": "test"}, "created_at": "2026-01-01T00:00:00Z", "updated_at": "2026-01-01T00:00:00Z", "state": "NEW", "routing": {"destination": "inbox", "reason": None, "retry_count": 0, "retry_not_before": None}, "analysis_revision": 0, "artifacts": {"case": None, "diagnosis": None, "change_request": None}, "history": {"analysis_revisions": 0, "reproductions": 0, "evidence": 0, "handoffs": 0, "feedback": 0, "events_ref": None}, "integrity": {} } @pytest.fixture def make_package(tmp_path, manifest): def make(*, entries=None, document=None, raw=None, name="arbitrary.bin", compression=zipfile.ZIP_STORED): path = tmp_path / name with zipfile.ZipFile(path, "w", compression=compression) as archive: archive.writestr("manifest.json", raw if raw is not None else json.dumps(document if document is not None else manifest)) for key, value in (entries or {}).items(): archive.writestr(key, value) return path return make