def test_to_parent_element_data(self): f = open(self.tmpfile) data = f.read() f.close() a = Attachment() a.data = data element = etree.Element('test') Attachment.to_parent_element(a, ns_test, element) element = element[0] encoded_data = base64.encodestring(data) self.assertNotEquals(element.text, None) self.assertEquals(element.text, encoded_data)
def test_from_xml(self): f = open(self.tmpfile) data = f.read() f.close() a = Attachment() a.data = data element = etree.Element('test') Attachment.to_parent_element(a, ns_test, element) element = element[0] a2 = Attachment.from_xml(element) self.assertEquals(data, a2.data)