diff options
Diffstat (limited to 'packages/meshbay-node/tests')
| -rw-r--r-- | packages/meshbay-node/tests/test_packaging_win.py | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/packages/meshbay-node/tests/test_packaging_win.py b/packages/meshbay-node/tests/test_packaging_win.py index 96351db..ad366d0 100644 --- a/packages/meshbay-node/tests/test_packaging_win.py +++ b/packages/meshbay-node/tests/test_packaging_win.py @@ -554,23 +554,32 @@ def test_reinstalling_with_everything_already_in_place_asks_nothing(): assert "Goto mb_auto_done" in install -def test_the_uninstaller_offers_to_remove_everything_privileged_default_no(): +def test_the_uninstaller_removes_everything_privileged_without_asking(): """ - Opt-in on the way out too, and defaulting to No: a stale allow-rule or - Scheduled Task is inert, so this should not nag. One elevation removes - both, unconditionally — service-mode.ps1's own remove actions are each - no-ops when there is nothing to remove, so this is safe to run whether or - not service mode was ever chosen. + No Yes/No first: there used to be one, default No, and an uninstall left + the firewall rules and the boot task behind unless the person thought to + say yes. The UAC prompt is the only question, and it is asked only when a + rule or the task is still there, read unelevated beforehand. One elevation + removes both. """ nsh = NSH.read_text(encoding="utf-8") uninstall = _macro_body(nsh, "customUnInstall") + assert "MessageBox" not in uninstall assert "${IfNot} ${Silent}" in uninstall assert "${AndIfNot} ${isUpdated}" in uninstall, "not while an upgrade replaces it" - assert "/SD IDNO" in uninstall, "the uninstall prompt should default to No" + i_task = uninstall.index('schtasks /query /tn "MeshBay Node"') + i_rules = uninstall.index('firewall.ps1" any') + i_runas = uninstall.index('ExecShellWait "runas"') + assert i_task < i_runas and i_rules < i_runas, "read first, elevate after" # uninstall, not remove: remove keeps the firewall rules (a mode switch). assert 'service-mode.ps1" -Action uninstall' in uninstall - assert 'ExecShellWait "runas"' in uninstall + + +def test_the_firewall_helper_can_tell_whether_any_rule_is_left(): + ps1 = (ROOT / "packaging" / "win" / "firewall.ps1").read_text(encoding="utf-8") + assert '"any"' in ps1.split("ValidateSet", 1)[1].split(")", 1)[0] + assert '$Action -eq "any"' in ps1 def test_an_upgrade_keeps_the_sign_in_launcher(): @@ -1163,13 +1172,13 @@ def test_light_installer_never_touches_a_co_installed_full_clients_node(): "belongs to a co-installed Full client, not to Light") -def test_light_uninstaller_offers_to_remove_the_firewall_rules_default_no(): +def test_light_uninstaller_removes_the_firewall_rules_without_asking(): nsh = LIGHT_NSH.read_text(encoding="utf-8") uninstall = _macro_body(nsh, "customUnInstall") + assert "MessageBox" not in uninstall assert "${IfNot} ${Silent}" in uninstall - assert "/SD IDNO" in uninstall + assert uninstall.index('firewall.ps1" any') < uninstall.index('ExecShellWait "runas"') assert 'firewall.ps1" remove' in uninstall - assert 'ExecShellWait "runas"' in uninstall # ── the app-side gaps a bundle-less build would otherwise hit ────────────── |