test_q3_desktop_integrity.py
python
sha256:a78e7e5a8740e03315f325d19edeb3aa1b306b3337d04abbaa9a9e0f3bbeb7a1
docs: MuseHub-first before ISR #74 — staging solidify NEXT
Human
13 hours ago
| 1 | """Data-integrity tests for Track Q / Q3 Tauri desktop packaging.""" |
| 2 | |
| 3 | from __future__ import annotations |
| 4 | |
| 5 | import subprocess |
| 6 | from pathlib import Path |
| 7 | |
| 8 | from tests.fixtures.app import seed_app_repo |
| 9 | from tests.fixtures.desktop import make_desktop_launcher |
| 10 | from tests.support import KIT_ROOT |
| 11 | from tools.desktop.launcher import build_launch_argv |
| 12 | from tools.desktop.manifest import DesktopManifest, validate_desktop_manifest |
| 13 | |
| 14 | |
| 15 | def test_launch_stop_twice_yields_same_health_shape(tmp_path: Path) -> None: |
| 16 | seed_app_repo(tmp_path) |
| 17 | first = make_desktop_launcher(tmp_path, seed=False) |
| 18 | second = make_desktop_launcher(tmp_path, seed=False) |
| 19 | try: |
| 20 | banner_one = first.start() |
| 21 | banner_two = second.start() |
| 22 | assert banner_one.url.startswith("http://127.0.0.1:") |
| 23 | assert banner_two.url.startswith("http://127.0.0.1:") |
| 24 | assert banner_one.session_credential != banner_two.session_credential |
| 25 | assert banner_one.csrf_token != banner_two.csrf_token |
| 26 | finally: |
| 27 | first.stop() |
| 28 | second.stop() |
| 29 | |
| 30 | |
| 31 | def test_bundle_script_produces_complete_kit_tree(tmp_path: Path) -> None: |
| 32 | dest = KIT_ROOT / "desktop" / "src-tauri" / "resources" / "kit" |
| 33 | if dest.exists(): |
| 34 | import shutil |
| 35 | |
| 36 | shutil.rmtree(dest) |
| 37 | |
| 38 | subprocess.run( |
| 39 | [str(KIT_ROOT / "scripts" / "bundle-desktop-kit.sh")], |
| 40 | cwd=KIT_ROOT, |
| 41 | check=True, |
| 42 | capture_output=True, |
| 43 | text=True, |
| 44 | ) |
| 45 | |
| 46 | for rel in ( |
| 47 | "cli/ok", |
| 48 | "adapters/__init__.py", |
| 49 | "tools/app/server.py", |
| 50 | "VERSION", |
| 51 | ): |
| 52 | assert (dest / rel).is_file(), rel |
| 53 | |
| 54 | argv = build_launch_argv(kit_root_path=dest, repo_root=tmp_path, port=9876) |
| 55 | assert argv[0].endswith("/cli/ok") |
| 56 | assert "9876" in argv |
| 57 | |
| 58 | |
| 59 | def test_manifest_still_valid_after_bundle(tmp_path: Path) -> None: |
| 60 | manifest = DesktopManifest.from_kit_root(KIT_ROOT) |
| 61 | assert validate_desktop_manifest(manifest) == [] |
File History
1 commit
sha256:a78e7e5a8740e03315f325d19edeb3aa1b306b3337d04abbaa9a9e0f3bbeb7a1
docs: MuseHub-first before ISR #74 — staging solidify NEXT
Human
13 hours ago