aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-node/tests/test_packaging_win.py
diff options
context:
space:
mode:
authorChristophe Besson <cbesson@gmail.com>2026-10-07 13:48:28 +0200
committerChristophe Besson <cbesson@gmail.com>2026-10-07 13:48:28 +0200
commitade41b05cce4a555197116568664220c5b3be9fa (patch)
treeee0124111e4e500d648a133db7feedfec13b4f2b /packages/meshbay-node/tests/test_packaging_win.py
parent3d5a168ee592c28c696e445c623c9f8d2996b715 (diff)
downloadmeshbay-ade41b05cce4a555197116568664220c5b3be9fa.tar.gz
fix(client): remove firewall rules and boot task on uninstall, unasked
The Yes/No before it defaulted to No, so they stayed behind. Read both unelevated and raise the UAC prompt only when one is left. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'packages/meshbay-node/tests/test_packaging_win.py')
-rw-r--r--packages/meshbay-node/tests/test_packaging_win.py31
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 ──────────────