diff --git a/product/ERP5SyncML/tests/testERP5DocumentSyncML.py b/product/ERP5SyncML/tests/testERP5DocumentSyncML.py index 1cfcaf0f4afc5d6a8fd8834eceb4dfe391ec594e..754d0eb1c7e28f9ce28762bddbc7f3812a6cebf0 100644 --- a/product/ERP5SyncML/tests/testERP5DocumentSyncML.py +++ b/product/ERP5SyncML/tests/testERP5DocumentSyncML.py @@ -529,8 +529,8 @@ class TestERP5DocumentSyncMLMixin(ERP5TypeTestCase): size_filename=self.size_filename_odt) self.checkXMLsSynchronized() - def assertXMLViewIsEqual(self, sub_id, object_pub=None, object_sub=None,\ - force=0): + def assertXMLViewIsEqual(self, sub_id, object_pub=None, object_sub=None, + force=False): """ Check the equality between two xml objects with gid as id """ @@ -541,28 +541,29 @@ class TestERP5DocumentSyncMLMixin(ERP5TypeTestCase): gid_sub = publication.getGidFromObject(object_sub) self.assertEqual(gid_pub, gid_sub) conduit = ERP5DocumentConduit() - xml_pub = conduit.getXMLFromObjectWithGid(object=object_pub, gid=gid_pub,\ - xml_mapping=publication.getXMLMapping()) + xml_pub = conduit.getXMLFromObjectWithGid(object=object_pub, gid=gid_pub, + xml_mapping=publication.getXMLMapping()) #if One Way From Server there is not xml_mapping for subscription - xml_sub = conduit.getXMLFromObjectWithGid(object=object_sub, gid=gid_sub,\ - xml_mapping=subscription.getXMLMapping(force)) + xml_sub = conduit.getXMLFromObjectWithGid(object=object_sub, gid=gid_sub, + xml_mapping=subscription.getXMLMapping(force)) erp5diff = ERP5Diff() erp5diff.compare(xml_pub, xml_sub) - result = erp5diff.outputString() - result = etree.XML(result) - if len(result) != 0 : - for update in result: - #XXX edit workflow is not replaced, so discard workflow checking - if update.get('select').find('workflow') != -1 or\ - update.find('block_data') != -1: - continue - else : - self.fail('diff between pub:\n%s \n => \n%s' %\ - (xml_pub, etree.tostring(result, pretty_print=True))) - - -class TestERP5DocumentSyncML(TestERP5DocumentSyncMLMixin, ERP5TypeTestCase): - + result = etree.XML(erp5diff.outputString()) + identity = True + for update in result: + #XXX edit workflow is not replaced, so discard workflow checking + if 'workflow' not in update.get('select', ''): + identity = False + break + if not identity: + self.fail('diff between %s and %s \nxupdate:\n%s' %\ + (object_pub.getRelativeUrl(), + object_sub.getRelativeUrl(), + etree.tostring(result, pretty_print=True))) + + +class TestERP5DocumentSyncML(TestERP5DocumentSyncMLMixin): + def getTitle(self): """ """