def test_process_xml_file_catch_exception(self, etree_from_string): """ Test catching AttributeError during parsing XML file. """ etree_from_string.return_value = '' names = utils.process_xml_file() self.assertFalse(names)
def test_downloading_xml_file_connection_failure(self, mock_open): """ Test catching connection failure during downloading xml file. """ mock_open.return_value = '' main.app.config.update({'XML_URL': 'wrong_url_path'}) self.assertFalse(utils.process_xml_file())
def test_process_xml_file(self): """ Test processing xml file """ xml = utils.process_xml_file() self.assertIsNotNone(xml) self.assertIsInstance(xml, etree._Element)