Author: gchapelle Date: Wed Nov 16 18:51:13 2005 New Revision: 1849 Modified: azax/trunk/tests/test_azaxresponse.py Log: tests pass
Modified: azax/trunk/tests/test_azaxresponse.py ============================================================================== --- azax/trunk/tests/test_azaxresponse.py (original) +++ azax/trunk/tests/test_azaxresponse.py Wed Nov 16 18:51:13 2005 @@ -43,28 +43,34 @@ def test_str_(self): ob = AzaxResponse() self.assertEquals(self.cleanupXMLForTesting(str(ob)), '<commands/>') + + def assertXMLEquals(self, a, b): + etree = config.etree + a = etree.tostring(etree.fromstring(a)) + b = etree.tostring(etree.fromstring(b)) + self.assertEquals(a, b) def test_addCommand(self): ob = AzaxResponse() command = ob.addCommand('name', 'selector') - self.assertEquals(self.cleanupXMLForTesting( + self.assertXMLEquals(self.cleanupXMLForTesting( config.etree.tostring(command.ob)), '<command selector="selector" name="name"/>') - self.assertEquals(self.cleanupXMLForTesting(str(ob)), + self.assertXMLEquals(self.cleanupXMLForTesting(str(ob)), '<commands><command selector="selector" name="name"/></commands>') def test_setHtmlAsChildTextOnly(self): ob = AzaxResponse() ob.setHtmlAsChild('div.class', 'new_content') - self.assertEquals(self.cleanupXMLForTesting(str(ob)), + self.assertXMLEquals(self.cleanupXMLForTesting(str(ob)), '<commands><command selector="div.class" name="setHtmlAsChild">' \ '<param name="html">new_content</param></command></commands>') def test_setHtmlAsChildTagOnly(self): ob = AzaxResponse() ob.setHtmlAsChild('div.class', '<p>new_content</p>') - self.assertEquals(self.cleanupXMLForTesting(str(ob)), + self.assertXMLEquals(self.cleanupXMLForTesting(str(ob)), '<commands><command selector="div.class" name="setHtmlAsChild">' \ '<param name="html"><p xmlns="http://www.w3.org/1999/xhtml">' \ 'new_content</p></param></command></commands>') @@ -72,7 +78,7 @@ def test_setHtmlAsChildTagPlusText(self): ob = AzaxResponse() ob.setHtmlAsChild('div.class', '<p>new_content</p>after') - self.assertEquals(self.cleanupXMLForTesting(str(ob)), + self.assertXMLEquals(self.cleanupXMLForTesting(str(ob)), '<commands><command selector="div.class" name="setHtmlAsChild">' \ '<param name="html"><p xmlns="http://www.w3.org/1999/xhtml">' \ 'new_content</p>after</param></command></commands>') @@ -80,7 +86,7 @@ def test_setHtmlAsChildTextTagPlusText(self): ob = AzaxResponse() ob.setHtmlAsChild('div.class', 'before<p>new_content</p>after') - self.assertEquals(self.cleanupXMLForTesting(str(ob)), + self.assertXMLEquals(self.cleanupXMLForTesting(str(ob)), '<commands><command selector="div.class" name="setHtmlAsChild">' \ '<param name="html">before<p xmlns="http://www.w3.org/1999/xhtml">' \ 'new_content</p>after</param></command></commands>') -- http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins