fix manual parser refresh reliability
All checks were successful
CI/CD Pipeline / Quality Gate (push) Successful in 1m11s
CI/CD Pipeline / Build and Push Images (push) Successful in 21s
CI/CD Pipeline / Internal Notify (push) Successful in 0s
CI/CD Pipeline / Deploy Dev via Compose (push) Successful in 32s

This commit is contained in:
2026-08-10 15:02:00 +02:00
parent 61e178544b
commit 1c2dd985d4
6 changed files with 165 additions and 46 deletions

View File

@@ -9,6 +9,7 @@ import tempfile
import types
from asyncio import events as asyncio_events
from pathlib import Path
from unittest.mock import patch
from xml.etree import ElementPath as element_path
from xml.etree import ElementTree as ET
@@ -563,6 +564,18 @@ class ProverkiParseXMLTest(SimpleTestCase):
inspections = client._parse_xml_content(xml)
self.assertEqual(len(inspections), 1)
def test_large_xml_streaming_does_not_build_sanitized_string(self):
xml = _xml_with_tag("INSPECTION", _inspection_attrs())
client = ProverkiClient()
client.STREAMING_THRESHOLD_BYTES = 1
with patch.object(
client,
"_sanitize_xml",
side_effect=AssertionError("large XML must stay as bytes"),
):
inspections = client._parse_xml_content(xml)
self.assertEqual(len(inspections), 1)
def test_parse_xml_record_missing_fields_returns_none(self):
element = ET.fromstring("<INSPECTION />") # noqa: S314
client = ProverkiClient()