from __future__ import annotations from pathlib import Path ROOT = Path(__file__).resolve().parents[3] PS1 = ROOT / "scripts/reboot-recovery/windows99-vmx-source-locate-check.ps1" COLLECTOR = ( ROOT / "scripts/reboot-recovery/collect-windows99-vmx-source-locate-check.sh" ) def test_windows99_vmx_source_locate_check_is_no_write_check_mode() -> None: text = PS1.read_text(encoding="utf-8") assert "AWOOOI_WINDOWS99_VMX_LOCATE_CHECK=1" in text assert 'ProgressPreference = "SilentlyContinue"' in text assert "secret_value_read=false" in text assert "remote_write_performed=false" in text assert "vm_power_change_performed=false" in text assert "expected_vmx_exists" in text assert "candidate_vmx_count" in text assert "VMX_IDENTITY_SUMMARY" in text assert "identity_unassigned_ubuntu_candidate_count" in text assert "single_identity_unassigned_ubuntu_candidate_requires_confirmation" in text assert "locate_status=" in text assert "Start-VM" not in text assert "vmrun" not in text assert "Set-Content" not in text assert "New-Item" not in text assert "Register-ScheduledTask" not in text assert "Set-ItemProperty" not in text def test_windows99_vmx_source_locate_collector_uses_publickey_only() -> None: text = COLLECTOR.read_text(encoding="utf-8") assert "windows99_vmx_source_locate_collector_v1" in text assert "BatchMode=yes" in text assert "PasswordAuthentication=no" in text assert "KbdInteractiveAuthentication=no" in text assert "NumberOfPasswordPrompts=0" in text assert "--via-host" in text assert "--include-identity-metadata" in text assert "[Console]::In.ReadToEnd()" in text assert "bootstrap_command" in text assert "payload_file" in text assert "secret_value_read=false" in text assert "remote_write_performed=false" in text assert "vm_power_change_performed=false" in text assert "scp " not in text assert "sudo " not in text