本文整理汇总了Python中Products.CMFCore.testing.DummyWorkflow类的典型用法代码示例。如果您正苦于以下问题:Python DummyWorkflow类的具体用法?Python DummyWorkflow怎么用?Python DummyWorkflow使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DummyWorkflow类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_fragment_skip_purge
def test_fragment_skip_purge(self):
from Products.CMFCore.exportimport.workflow import importWorkflowTool
WF_ID_NON = 'non_dcworkflow_%s'
WF_TITLE_NON = 'Non-DCWorkflow #%s'
site, wf_tool = self._initSite()
for i in range(4):
nondcworkflow = DummyWorkflow(WF_TITLE_NON % i)
nondcworkflow.title = WF_TITLE_NON % i
wf_tool._setObject(WF_ID_NON % i, nondcworkflow)
wf_tool._default_chain = (WF_ID_NON % 1,)
wf_tool._chains_by_type['sometype'] = (WF_ID_NON % 2,)
self.assertEqual(len(wf_tool.objectIds()), 4)
context = DummyImportContext(site, False)
context._files['workflows.xml'] = self._FRAGMENT_IMPORT
importWorkflowTool(context)
self.assertEqual(len(wf_tool.objectIds()), 4)
self.assertEqual(len(wf_tool._default_chain), 1)
self.assertEqual(wf_tool._default_chain[0], WF_ID_NON % 1)
self.assertEqual(len(wf_tool._chains_by_type), 0)
示例2: test_bindings_skip_purge
def test_bindings_skip_purge(self):
from Products.CMFCore.exportimport.workflow import importWorkflowTool
WF_ID_NON = 'non_dcworkflow_%s'
WF_TITLE_NON = 'Non-DCWorkflow #%s'
site = self._initSite()
wf_tool = site.portal_workflow
for i in range(4):
nondcworkflow = DummyWorkflow(WF_TITLE_NON % i)
nondcworkflow.title = WF_TITLE_NON % i
wf_tool._setObject(WF_ID_NON % i, nondcworkflow)
wf_tool._default_chain = (WF_ID_NON % 1,)
wf_tool._chains_by_type['sometype'] = (WF_ID_NON % 2,)
self.assertEqual(len(wf_tool.objectIds()), 4)
context = DummyImportContext(site, False)
context._files['workflows.xml'] = self._BINDINGS_TOOL_EXPORT
importWorkflowTool(context)
self.assertEqual(len(wf_tool.objectIds()), 4)
self.assertEqual(len(wf_tool._default_chain), 2)
self.assertEqual(wf_tool._default_chain[0], WF_ID_NON % 0)
self.assertEqual(wf_tool._default_chain[1], WF_ID_NON % 1)
self.assertEqual(len(wf_tool._chains_by_type), 2)
self.assertEqual(wf_tool._chains_by_type['sometype'],
(WF_ID_NON % 2,))
self.assertEqual(wf_tool._chains_by_type['anothertype'],
(WF_ID_NON % 3,))
示例3: test_empty_explicit_purge
def test_empty_explicit_purge(self):
from Products.CMFCore.exportimport.workflow import importWorkflowTool
WF_ID_NON = 'non_dcworkflow_%s'
WF_TITLE_NON = 'Non-DCWorkflow #%s'
site = self._initSite()
wf_tool = site.portal_workflow
for i in range(4):
nondcworkflow = DummyWorkflow(WF_TITLE_NON % i)
nondcworkflow.title = WF_TITLE_NON % i
wf_tool._setObject(WF_ID_NON % i, nondcworkflow)
wf_tool._default_chain = (WF_ID_NON % 1,)
wf_tool._chains_by_type['sometype'] = (WF_ID_NON % 2,)
self.assertEqual(len(wf_tool.objectIds()), 4)
context = DummyImportContext(site, True)
context._files['workflows.xml'] = self._EMPTY_TOOL_EXPORT
importWorkflowTool(context)
self.assertEqual(len(wf_tool.objectIds()), 0)
self.assertEqual(len(wf_tool._default_chain), 0)
self.assertEqual(len(wf_tool._chains_by_type), 0)
示例4: test_normal
def test_normal(self):
from Products.CMFCore.exportimport.workflow import exportWorkflowTool
WF_ID_NON = 'non_dcworkflow'
WF_TITLE_NON = 'Non-DCWorkflow'
site, wf_tool = self._initSite()
nondcworkflow = DummyWorkflow(WF_TITLE_NON)
nondcworkflow.title = WF_TITLE_NON
wf_tool._setObject(WF_ID_NON, nondcworkflow)
context = DummyExportContext(site)
exportWorkflowTool(context)
self.assertEqual(len(context._wrote), 2)
filename, text, content_type = context._wrote[0]
self.assertEqual(filename, 'workflows.xml')
self._compareDOM(text, _NORMAL_TOOL_EXPORT)
self.assertEqual(content_type, 'text/xml')