test_q3_desktop_integrity.py python
61 lines 1.9 KB
Raw
sha256:0e9549ec7b463911bc08b7d586dc320b1ac9b1f5c943ee7e3865dcc6cb0f6f83 chore(governance): sync handover+roadmap to 84db8c8 (drift:… Human 1 day 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:6abcf1fa82a7a621ccbc945f19acdba5bc0db54569599404a1452fb4a096a199 fix(ISR): default require_independent_second_reviewer to require Human minor 1 day ago