fix: decode WinRM Cyrillic from CP866 and show deploy.log UTF-8 (0.20.17)

This commit is contained in:
PTah
2026-06-20 19:58:54 +10:00
parent 9484160045
commit 4d9a9e7e2b
4 changed files with 69 additions and 7 deletions
+20
View File
@@ -15,6 +15,7 @@ from app.services.winrm_connect import (
WinRmCmdResult,
_clixml_to_plain,
_custom_deploy_body,
_decode_winrm_bytes,
_deploy_from_staging_body,
_download_bundle_body,
_prepare_staging_body,
@@ -23,6 +24,25 @@ from app.services.winrm_connect import (
)
def test_decode_winrm_bytes_reads_russian_cp866_console():
sample = "Деплой: корень шары".encode("cp866")
decoded = _decode_winrm_bytes(sample)
assert "Деплой" in decoded
assert "шары" in decoded
def test_decode_winrm_bytes_handles_utf8_multibyte():
text = "\u0414\u0435\u043f\u043b\u043e\u0439: \u043a\u043e\u0440\u0435\u043d\u044c \u0448\u0430\u0440\u044b"
assert _decode_winrm_bytes(text.encode("utf-8")) == text
def test_deploy_from_staging_includes_deploy_log_tail():
script = _deploy_from_staging_body(RDP_REMOTE_STAGING)
assert "deploy.log" in script
assert "Get-Content" in script
assert "-Encoding UTF8" in script
def test_prepare_staging_recreates_remote_dir():
script = _prepare_staging_body(RDP_REMOTE_STAGING)
assert "Remove-Item" in script