Commit fba26c24 authored by Nicolas Delaby's avatar Nicolas Delaby

Fix assertXMLViewIsEqual

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@35833 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 620af1eb
...@@ -529,8 +529,8 @@ class TestERP5DocumentSyncMLMixin(ERP5TypeTestCase): ...@@ -529,8 +529,8 @@ class TestERP5DocumentSyncMLMixin(ERP5TypeTestCase):
size_filename=self.size_filename_odt) size_filename=self.size_filename_odt)
self.checkXMLsSynchronized() self.checkXMLsSynchronized()
def assertXMLViewIsEqual(self, sub_id, object_pub=None, object_sub=None,\ def assertXMLViewIsEqual(self, sub_id, object_pub=None, object_sub=None,
force=0): force=False):
""" """
Check the equality between two xml objects with gid as id Check the equality between two xml objects with gid as id
""" """
...@@ -541,28 +541,29 @@ class TestERP5DocumentSyncMLMixin(ERP5TypeTestCase): ...@@ -541,28 +541,29 @@ class TestERP5DocumentSyncMLMixin(ERP5TypeTestCase):
gid_sub = publication.getGidFromObject(object_sub) gid_sub = publication.getGidFromObject(object_sub)
self.assertEqual(gid_pub, gid_sub) self.assertEqual(gid_pub, gid_sub)
conduit = ERP5DocumentConduit() conduit = ERP5DocumentConduit()
xml_pub = conduit.getXMLFromObjectWithGid(object=object_pub, gid=gid_pub,\ xml_pub = conduit.getXMLFromObjectWithGid(object=object_pub, gid=gid_pub,
xml_mapping=publication.getXMLMapping()) xml_mapping=publication.getXMLMapping())
#if One Way From Server there is not xml_mapping for subscription #if One Way From Server there is not xml_mapping for subscription
xml_sub = conduit.getXMLFromObjectWithGid(object=object_sub, gid=gid_sub,\ xml_sub = conduit.getXMLFromObjectWithGid(object=object_sub, gid=gid_sub,
xml_mapping=subscription.getXMLMapping(force)) xml_mapping=subscription.getXMLMapping(force))
erp5diff = ERP5Diff() erp5diff = ERP5Diff()
erp5diff.compare(xml_pub, xml_sub) erp5diff.compare(xml_pub, xml_sub)
result = erp5diff.outputString() result = etree.XML(erp5diff.outputString())
result = etree.XML(result) identity = True
if len(result) != 0 : for update in result:
for update in result: #XXX edit workflow is not replaced, so discard workflow checking
#XXX edit workflow is not replaced, so discard workflow checking if 'workflow' not in update.get('select', ''):
if update.get('select').find('workflow') != -1 or\ identity = False
update.find('block_data') != -1: break
continue if not identity:
else : self.fail('diff between %s and %s \nxupdate:\n%s' %\
self.fail('diff between pub:\n%s \n => \n%s' %\ (object_pub.getRelativeUrl(),
(xml_pub, etree.tostring(result, pretty_print=True))) object_sub.getRelativeUrl(),
etree.tostring(result, pretty_print=True)))
class TestERP5DocumentSyncML(TestERP5DocumentSyncMLMixin, ERP5TypeTestCase):
class TestERP5DocumentSyncML(TestERP5DocumentSyncMLMixin):
def getTitle(self): def getTitle(self):
""" """
""" """
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment