aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-node
diff options
context:
space:
mode:
Diffstat (limited to 'packages/meshbay-node')
-rw-r--r--packages/meshbay-node/tests/test_packaging_win.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/packages/meshbay-node/tests/test_packaging_win.py b/packages/meshbay-node/tests/test_packaging_win.py
index ba3568c..20a2505 100644
--- a/packages/meshbay-node/tests/test_packaging_win.py
+++ b/packages/meshbay-node/tests/test_packaging_win.py
@@ -199,6 +199,24 @@ def test_the_installer_offers_one_elevated_firewall_step_instead_of_two_dialogs(
assert 'firewall.ps1" add' in install
+def test_reinstalling_with_the_rules_already_in_place_asks_nothing():
+ """
+ Get-NetFirewallRule needs no admin, only New/Remove do — so customInstall
+ checks first, unelevated, and only reaches the MessageBox (and therefore
+ the UAC prompt) when something is actually missing. Without this, running
+ setup a second time — an upgrade, a repair install — would re-ask the
+ question and re-trigger UAC even though nothing needs to change.
+ """
+ nsh = NSH.read_text(encoding="utf-8")
+ install = _macro_body(nsh, "customInstall")
+
+ check_line = 'firewall.ps1" check'
+ assert check_line in install
+ # The check must run, and be evaluated, before the MessageBox — not after.
+ assert install.index(check_line) < install.index("MessageBox MB_YESNO")
+ assert "Pop $0" in install and "${If} $0 != 0" in install
+
+
def test_the_uninstaller_offers_to_remove_the_firewall_rules_default_no():
"""Opt-in on the way out too, and defaulting to No: a stale allow-rule
for a deleted exe is inert, so this should not nag."""