Ejemplo n.º 1
0
    def test_xml_from_file_does_not_exist(self):
        log = TestXmlUtils.MockLog()

        with self.assertRaises(IOError):
            xml_from_file(self.XML_MISSING_FILE, log)

        self.assertIn('failed to read xml file', log.message)
Ejemplo n.º 2
0
    def test_xml_from_file_syntax_error(self):
        log = TestXmlUtils.MockLog()

        with self.assertRaises(etree.XMLSyntaxError):
            xml_from_file(self.XML_SYNTAX_ERROR_FILE, log)

        self.assertIn('failed to parse xml file', log.message)
Ejemplo n.º 3
0
    def test_xml_from_file_syntax_error(self):
        log = TestXmlUtils.MockLog()

        with self.assertRaises(etree.XMLSyntaxError):
            xml_from_file(self.XML_SYNTAX_ERROR_FILE, log)

        self.assertIn('failed to parse xml file', log.message)
Ejemplo n.º 4
0
    def test_xml_from_file_does_not_exist(self):
        log = TestXmlUtils.MockLog()

        with self.assertRaises(IOError):
            xml_from_file(self.XML_MISSING_FILE, log)

        self.assertIn('failed to read xml file', log.message)
Ejemplo n.º 5
0
 def test_xml_from_file(self):
     result = xml_from_file(self.XML_FILE, TestXmlUtils.MockLog())
     self.assertEqual(result.text, 'aaa')
Ejemplo n.º 6
0
 def test_xml_from_file(self):
     result = xml_from_file(self.XML_FILE, TestXmlUtils.MockLog())
     self.assertEqual(result.text, 'aaa')
Ejemplo n.º 7
0
 def test_xml_from_file(self):
     result = xml_from_file(self.XML_FILE, TestXmlUtils.MockLog())
     self.assertIn('Source:', result[0].text)
     self.assertEqual(result[1].text, 'aaa')