fix manual parser refresh reliability
All checks were successful
All checks were successful
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user