Commit ec1a7f1e authored by Nicolas Wavrant's avatar Nicolas Wavrant

fixup

parent 54f40375
......@@ -3186,32 +3186,48 @@ class TestZodbDocumentComponentReload(TestZodbDocumentComponent):
muppy.filter(all_object_list, Type=types.TypeType)
)
def testAsComposedDocumentCacheIsCorrectlyFlushed(self):
bp_component = self.portal.portal_components['document.erp5.BusinessProcess']
bp_original_text_content = bp_component.getTextContent()
def _setBusinessProcessComponentTextContent(self, value):
component = self.portal.portal_components['document.erp5.BusinessProcess']
component.setTextContent(value)
self.tic()
bp_component.setTextContent(
bp_original_text_content + """
def testAsComposedDocumentCacheIsCorrectlyFlushed(self):
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):
return 1
"""
)
self.tic()
"""
)
movement = self.portal.newContent(portal_type='Movement')
composed_movement = movement.asComposedDocument()
self.assertEqual(composed_movement.getVersion(), 1)
movement = self.portal.newContent(portal_type='Movement')
composed_movement = movement.asComposedDocument()
self.assertEqual(composed_movement.getVersion(), 1)
bp_component.setTextContent(
bp_original_text_content + """
self._setBusinessProcessComponentTextContent(
component_original_text_content + """
def getVersion(self):
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():
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