Files
TimeTracker/tests/test_invoice_validators.py
T
Dries Peeters 777d6ad3bf fix(invoicing): harden PEPPOL transport and PDF/A-3 export compliance
Implement native PEPPOL transport plumbing (identifier validation, SMP/SML discovery, and AS4 send path) and make ZUGFeRD/PDF export fail fast when embedding or PDF/A-3 normalization fails. Add settings, migrations, validators, tests, and docs so compliance issues are visible and verifiable.
2026-03-02 20:55:02 +01:00

28 lines
907 B
Python

"""Tests for invoice validators (UBL well-formed, veraPDF optional)."""
import pytest
from app.utils.invoice_validators import validate_ubl_wellformed
@pytest.mark.unit
def test_validate_ubl_wellformed_accepts_valid_invoice():
ubl = '<?xml version="1.0"?><Invoice xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2"><ID>INV-001</ID></Invoice>'
passed, msgs = validate_ubl_wellformed(ubl)
assert passed is True
assert msgs == []
@pytest.mark.unit
def test_validate_ubl_wellformed_rejects_invalid_xml():
passed, msgs = validate_ubl_wellformed("<bad>")
assert passed is False
assert len(msgs) >= 1
@pytest.mark.unit
def test_validate_ubl_wellformed_rejects_non_invoice_root():
ubl = '<?xml version="1.0"?><NotInvoice xmlns="urn:test"><x/></NotInvoice>'
passed, msgs = validate_ubl_wellformed(ubl)
assert passed is False
assert "Invoice" in msgs[0]