from pathlib import Path

SCRIPT = Path("scripts/audit_jasmin_converted_invoice_format.py")


def test_jasmin_invoice_format_audit_script_exists():
    text = SCRIPT.read_text(encoding="utf-8")
    assert "CONVERTED_INVOICES_TO_SCAN" in text
    assert "print_invoice_pdf" in text
    assert "MediaBox" in text
    assert "not_pdf_header" in text
    assert "non_a4_or_unexpected_mediabox" in text


def test_jasmin_invoice_format_audit_is_read_only():
    text = SCRIPT.read_text(encoding="utf-8").lower()
    forbidden = ["insert into", "update ", "delete from", "create_outbox_item", "create_invoice_from_quotation"]
    for token in forbidden:
        assert token not in text
