from __future__ import annotations from pathlib import Path ROOT = Path(__file__).resolve().parents[2] def test_rest_deploy_refuses_to_drop_service_authentication() -> None: source = (ROOT / "scripts" / "deploy_1c_adapter_stack.ps1").read_text(encoding="utf-8-sig") assert "function Ensure-RestServiceToken" in source assert "ONEC_ADAPTER_ALLOW_UNAUTHENTICATED_ADMIN" in source assert "Reusing the existing REST service token without printing or persisting it" in source assert "Refusing to deploy an unauthenticated adapter" in source assert source.index("Ensure-RestServiceToken") < source.index("Invoke-ComposeUp `", source.index("try {"))