fix: WinRM try host.hostname first like Enter-PSSession (0.10.4)
This commit is contained in:
@@ -4,6 +4,7 @@ from unittest.mock import patch
|
||||
|
||||
from app.models.ui_settings import UI_SETTINGS_ROW_ID, UiSettings
|
||||
from app.services.win_admin_settings import normalize_win_admin_user
|
||||
from app.services.winrm_connect import iter_winrm_targets
|
||||
|
||||
|
||||
def test_normalize_win_admin_user():
|
||||
@@ -11,6 +12,21 @@ def test_normalize_win_admin_user():
|
||||
assert normalize_win_admin_user(r"B26\papatramp") == r"B26\papatramp"
|
||||
|
||||
|
||||
def test_iter_winrm_targets_hostname_before_ip():
|
||||
from app.models import Host
|
||||
|
||||
host = Host(
|
||||
hostname="Andrisonova-PC",
|
||||
os_family="windows",
|
||||
product="rdp-login-monitor",
|
||||
ipv4="192.168.1.50",
|
||||
inventory={"computer_name": "Andrisonova-PC"},
|
||||
)
|
||||
targets = iter_winrm_targets(host)
|
||||
assert targets[0] == "Andrisonova-PC"
|
||||
assert targets[-1] == "192.168.1.50"
|
||||
|
||||
|
||||
def test_get_win_admin_settings_env_default(jwt_headers, client, monkeypatch):
|
||||
monkeypatch.setenv("SAC_WIN_ADMIN_USER", "")
|
||||
monkeypatch.setenv("SAC_WIN_ADMIN_PASSWORD", "")
|
||||
|
||||
Reference in New Issue
Block a user