def test_toString_NoChangesMade_ReturnOriginalXml(self): xml = Xml('<some>xml</some>') result = xml.toString() self.assertEqual('<some>xml</some>', result)
def test_toString_setFirstNodeTextReturnsFalse_ReturnOriginalXml(self): xml = Xml('<element><other>text</other></element>') xml.setFirstNodeText('.//notfound', 'whatever') result = xml.toString() self.assertEqual('<element><other>text</other></element>', result)
def test_toString_XmlHeaderAndSetFirstNodeTextReturnsTrue_XmlHeaderRemoved(self): xml = Xml("<?xml version='1.0' encoding='UTF-8'?>\n<element><other>text</other></element>") xml.setFirstNodeText('.//other', 'pies') result = xml.toString() self.assertEqual('<element><other>pies</other></element>', result)
def test_toString_setFirstNodeTextReturnsTrue_ReturnModifiedXml(self): xml = Xml('<element><other>text</other></element>') xml.setFirstNodeText('.//other', 'pies') result = xml.toString() self.assertEqual('<element><other>pies</other></element>', result)