Commit ec1a7f1e authored by Nicolas Wavrant's avatar Nicolas Wavrant

fixup

parent 54f40375
...@@ -3186,32 +3186,48 @@ class TestZodbDocumentComponentReload(TestZodbDocumentComponent): ...@@ -3186,32 +3186,48 @@ class TestZodbDocumentComponentReload(TestZodbDocumentComponent):
muppy.filter(all_object_list, Type=types.TypeType) muppy.filter(all_object_list, Type=types.TypeType)
) )
def testAsComposedDocumentCacheIsCorrectlyFlushed(self): def _setBusinessProcessComponentTextContent(self, value):
bp_component = self.portal.portal_components['document.erp5.BusinessProcess'] component = self.portal.portal_components['document.erp5.BusinessProcess']
bp_original_text_content = bp_component.getTextContent() component.setTextContent(value)
self.tic()
bp_component.setTextContent( def testAsComposedDocumentCacheIsCorrectlyFlushed(self):
bp_original_text_content + """ component = self.portal.portal_components['document.erp5.BusinessProcess']
component_original_text_content = component.getTextContent()
# Use try/finally to restore the content of
# document.erp5.BusinessProcess as using addCleanup function here raises
# with :
# ConnectionStateError: Shouldn't load state for
# Products.DCWorkflow.Scripts.Scripts 0x099ad38a68606074
# when the connection is closed
try:
self._setBusinessProcessComponentTextContent(
component_original_text_content + """
def getVersion(self): def getVersion(self):
return 1 return 1
""" """
) )
self.tic()
movement = self.portal.newContent(portal_type='Movement') movement = self.portal.newContent(portal_type='Movement')
composed_movement = movement.asComposedDocument() composed_movement = movement.asComposedDocument()
self.assertEqual(composed_movement.getVersion(), 1) self.assertEqual(composed_movement.getVersion(), 1)
bp_component.setTextContent( self._setBusinessProcessComponentTextContent(
bp_original_text_content + """ component_original_text_content + """
def getVersion(self): def getVersion(self):
return 2 return 2
""" """
) )
self.tic()
composed_movement = movement.asComposedDocument()
self.assertEqual(composed_movement.getVersion(), 2)
finally:
self._setBusinessProcessComponentTextContent(
component_original_text_content
)
composed_movement = movement.asComposedDocument()
self.assertEqual(composed_movement.getVersion(), 2)
def test_suite(): def test_suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
......
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