fix(winrm): resolve System32 path for cmd test on minimal PATH (0.20.25)

WinRM run_cmd(hostname) failed on hosts where System32 is not in PATH.
This commit is contained in:
PTah
2026-06-21 20:49:01 +10:00
parent 75eec35365
commit 7397ec30cd
6 changed files with 37 additions and 7 deletions
+2 -2
View File
@@ -4,6 +4,6 @@ from app.version import APP_NAME, APP_VERSION, APP_VERSION_LABEL
def test_version_constants():
assert APP_VERSION == "0.20.22"
assert APP_VERSION == "0.20.25"
assert APP_NAME == "Security Alert Center"
assert APP_VERSION_LABEL == "Security Alert Center v.0.20.22"
assert APP_VERSION_LABEL == "Security Alert Center v.0.20.25"
+8
View File
@@ -95,6 +95,14 @@ def test_rdp_bundle_zip_roundtrip(tmp_path: Path, monkeypatch):
assert get_rdp_bundle_zip(token) == zip_bytes
def test_resolve_winrm_cmd_uses_system32_for_builtins():
from app.services.winrm_connect import _resolve_winrm_cmd
assert _resolve_winrm_cmd("hostname") == "%SystemRoot%\\System32\\hostname.exe"
assert _resolve_winrm_cmd("qwinsta") == "%SystemRoot%\\System32\\qwinsta.exe"
assert _resolve_winrm_cmd("logoff 2 /v") == "%SystemRoot%\\System32\\logoff.exe 2 /v"
def test_run_winrm_rdp_monitor_update_downloads_bundle_from_sac(tmp_path: Path):
repo = tmp_path / "repo"
repo.mkdir()