4386838b69
The full installer experience as a GUI wizard (gui/setup_wizard.py): environment summary → pick dependency bundles (from the catalog, grouped) → install missing apt packages → choose recording trigger → readiness summary. - Shown on first launch (config setup_done) and via `rigdoctor-gui --setup`; re-runnable from Settings → Run setup wizard. - install.sh launches it after a fresh install when a desktop session is present. - catalog.by_bundle() groups components; config gains setup_done. - Tests: by_bundle grouping + wizard construction smoke. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
54 lines
1.9 KiB
Python
54 lines
1.9 KiB
Python
"""Tests for the M9 installer logic and the M13 version comparison."""
|
|
|
|
import unittest
|
|
|
|
from rigdoctor.core import catalog, installer
|
|
from rigdoctor.core.catalog import Component
|
|
from rigdoctor.core.updates import is_newer
|
|
|
|
|
|
class InstallerTests(unittest.TestCase):
|
|
def test_component_status_uses_presence(self):
|
|
status = installer.component_status(present=lambda cmd: cmd == "smartctl")
|
|
by_id = {c.id: ok for c, ok in status}
|
|
self.assertTrue(by_id["smartmontools"])
|
|
self.assertFalse(by_id["dmidecode"])
|
|
|
|
def test_missing_packages_dedup_preserves_order(self):
|
|
comps = [
|
|
Component("a", "A", "B", "x", ("p1", "p2"), "c1"),
|
|
Component("b", "B", "B", "y", ("p2", "p3"), "c2"),
|
|
]
|
|
self.assertEqual(installer.missing_packages(comps), ["p1", "p2", "p3"])
|
|
|
|
def test_apt_command_includes_packages(self):
|
|
joined = " ".join(installer.apt_install_command(["smartmontools", "dmidecode"]))
|
|
self.assertIn("smartmontools", joined)
|
|
self.assertIn("dmidecode", joined)
|
|
self.assertIn("apt-get install", joined)
|
|
|
|
def test_install_nothing_is_noop(self):
|
|
rc, _ = installer.install_packages([])
|
|
self.assertEqual(rc, 0)
|
|
|
|
def test_by_bundle_groups_all_components(self):
|
|
groups = catalog.by_bundle()
|
|
flat = [c for comps in groups.values() for c in comps]
|
|
self.assertEqual(len(flat), len(catalog.COMPONENTS))
|
|
self.assertIn("Gaming", groups)
|
|
self.assertIn("Diagnostics", groups)
|
|
|
|
|
|
class UpdateTests(unittest.TestCase):
|
|
def test_is_newer(self):
|
|
self.assertTrue(is_newer("v0.0.5", "0.0.4"))
|
|
self.assertFalse(is_newer("v0.0.4", "0.0.4"))
|
|
self.assertFalse(is_newer("v0.0.3", "0.0.4"))
|
|
|
|
def test_is_newer_handles_garbage(self):
|
|
self.assertFalse(is_newer("not-a-version", "0.0.4"))
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|