mirror of
https://github.com/DRYTRIX/TimeTracker.git
synced 2026-05-20 13:20:38 -05:00
777d6ad3bf
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.
28 lines
907 B
Python
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]
|