from __future__ import annotations

from pathlib import Path


ROOT = Path(__file__).resolve().parents[3]
SCRIPT = ROOT / "scripts" / "reboot-recovery" / "post-reboot-readiness-summary.sh"


def test_unknown_backup_escrow_evidence_stays_blocked() -> None:
    text = SCRIPT.read_text(encoding="utf-8")

    assert "escrow_evidence_unknown=0" in text
    assert 'elif [[ -z "$escrow_missing_count" ]]; then' in text
    assert "escrow_evidence_unknown=1" in text
    assert "DR_ESCROW_EVIDENCE_UNKNOWN=$escrow_evidence_unknown" in text
    assert (
        '[[ "$backup_core_green" != "1" ]] '
        '&& next_required_gates+=("backup_core_readback_recovery")'
    ) in text
    assert (
        '[[ "$dr_escrow_blocked" == "1" ]] '
        '&& next_required_gates+=("credential_escrow_evidence")'
    ) in text
