diff --git a/tests/conftest.py b/tests/conftest.py index 071e268..ad8648c 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -33,8 +33,8 @@ def download_mdto_xsd(target_dir): response = requests.get(xsd_url) response.raise_for_status() # raise error if download failed - with open(target_dir / xsd_filename, "w") as f: - f.write(response.text) + with open(target_dir / xsd_filename, "wb") as f: + f.write(response.content) @pytest.fixture diff --git a/tests/test_mdto_xsd.py b/tests/test_mdto_xsd.py index 986fcc4..8af7ba5 100644 --- a/tests/test_mdto_xsd.py +++ b/tests/test_mdto_xsd.py @@ -8,16 +8,7 @@ def test_informatieobject_xml_validity(mdto_xsd): """Test if running to_xml() on a informatieobject procudes valid MDTO XML""" # create a schema object from the MDTO XSD - with open(mdto_xsd, 'rb') as f: - mdto_xsd_str = f.read() - - with open(mdto_xsd, "r", encoding="utf-8") as f: - xsd_content = f.read() - - print(xsd_content.encode("utf-8")) # Ensure all characters can be re-encoded to UTF-8 - - utf8 = b'\n'+mdto_xsd_str - mdto_schema = ET.XMLSchema(ET.fromstring(utf8)) + mdto_schema = ET.XMLSchema(ET.parse(mdto_xsd)) # create informatieobject informatieobject = Informatieobject( naam="Verlenen kapvergunning",