diff --git a/src/main.py b/src/main.py index 6ee4770..81be140 100644 --- a/src/main.py +++ b/src/main.py @@ -2,7 +2,7 @@ import os import logging import webbrowser -from xml.dom import minidom +from defusedxml.minidom import parseString import questionary @@ -138,7 +138,7 @@ def indent_xml_file(file_path: str) -> None: with open(file_path, "r") as xml_file: xml_content = xml_file.read() - xml_dom = minidom.parseString(xml_content) + xml_dom = parseString(xml_content) with open(file_path, "w") as xml_file: xml_file.write(xml_dom.toprettyxml(indent=" ")) diff --git a/tests/test_main.py b/tests/test_main.py index fb7b2e7..8fe065f 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -108,7 +108,7 @@ def test_indent_xml_file(self): def test_indent_xml_file_error(self): file_path = "assets/test.xml" - with patch('src.main.minidom.parseString') as mock_parseString: + with patch('src.main.parseString') as mock_parseString: mock_parseString.return_value = Exception("Error") indent_xml_file(file_path)