def testXML(self): '''Test XML serialization and recomposition from XML. ''' a = ResourceAttributes('uri:fish', 'Fish', ['text/html'], 'A book about fish.') doc = xml.dom.minidom.getDOMImplementation().createDocument(None, None, None) node = a.toXML(doc) b = ResourceAttributes(node=node) self.assertEquals(a, b)
def testXMLValidity(self): '''Test to see if all required XML elements are in there. ''' a = ResourceAttributes('uri:anus', 'Anus', ['text/html'], 'The anus, rectum, and other parts of the bum.', ['Buttman'], ['butts', 'henies', 'booties'], ['Butts and Co Publishing'], ['Dr Eugene Bottomman, III'], [], ['reference'], ['The Big Book of Booty'], ['en'], ['Buttholes and other oddities'], ['anatomy'], ['Cannot touch this'], ['system.buttServer'], 'granule', 'system.buttServer', ['http://butt.info/butt']) doc = xml.dom.minidom.getDOMImplementation().createDocument(None, None, None) node = a.toXML(doc) childElements = [n.nodeName for n in node.childNodes] self.assertEquals([u'Identifier', u'Title', u'Format', u'Description', u'Creator', u'Subject', u'Subject', u'Subject', u'Publisher', u'Contributor', u'Type', u'Source', u'Language', u'Relation', u'Coverage', u'Rights', u'resContext', u'resAggregation', u'resClass', u'resLocation'], childElements)