Commit 31b55e4c authored by Romain Courteaud's avatar Romain Courteaud

Remove created worklist at the end of the test, in order to prevent other tests

to fail.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@27757 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 943cf756
......@@ -174,6 +174,10 @@ class TestWorklist(ERP5TypeTestCase):
(k.startswith('guard_') and k or 'var_match_'+k, v)
for k, v in kw.iteritems()))
def removeWorklist(self, workflow_id, worklist_id_list):
worklists = self.getWorkflowTool()[workflow_id].worklists
worklists.deleteWorklists(worklist_id_list)
def createWorklists(self):
for worklist_id, actbox_name, role, expr, state, int_variable in [
(self.worklist_assignor_id, self.actbox_assignor_name,
......@@ -195,6 +199,16 @@ class TestWorklist(ERP5TypeTestCase):
validation_state=state,
**{self.int_catalogued_variable_id: int_variable})
def removeWorklists(self):
self.removeWorklist(self.checked_workflow, [
self.worklist_assignor_id,
self.worklist_owner_id,
self.worklist_desactivated_id,
self.worklist_wrong_state_id,
self.worklist_assignor_owner_id,
self.worklist_int_variable_id,
])
def clearCache(self):
self.portal.portal_caches.clearAllCache()
......@@ -222,6 +236,7 @@ class TestWorklist(ERP5TypeTestCase):
self.addWorkflowCataloguedVariable(self.checked_workflow,
self.int_catalogued_variable_id)
self.createWorklists()
try:
self.logMessage("Create document as Manager")
document = self.createDocument()
......@@ -340,6 +355,8 @@ class TestWorklist(ERP5TypeTestCase):
sql_catalog.sql_catalog_local_role_keys = \
current_sql_catalog_local_role_keys
transaction.commit()
finally:
self.removeWorklists()
def test_02_related_key(self, quiet=0, run=run_all_test):
"""
......@@ -369,6 +386,7 @@ class TestWorklist(ERP5TypeTestCase):
portal_type=self.checked_portal_type,
base_category_id='role')
try:
document = self.createDocument()
transaction.commit()
self.tic()
......@@ -391,6 +409,9 @@ class TestWorklist(ERP5TypeTestCase):
result = workflow_tool.listActions(object=document)
self.checkWorklist(result, 'has_region', 2)
self.checkWorklist(result, 'has_role', 1)
finally:
self.removeWorklist(self.checked_workflow,
['region_worklist', 'role_worklist'])
def test_03_worklist_guard(self, quiet=0, run=run_all_test):
"""
......@@ -411,6 +432,7 @@ class TestWorklist(ERP5TypeTestCase):
guard_roles="Associate",
guard_expr='python: user.getId() == "bar"')
try:
document = self.createDocument()
document.manage_addLocalRoles("bar", ["Associate"])
document.manage_addLocalRoles("foo", ["Associate"])
......@@ -433,6 +455,9 @@ class TestWorklist(ERP5TypeTestCase):
self.login('foo')
result = workflow_tool.listActions(object=document)
self.checkWorklist(result, 'valid_guard_expression', 0)
finally:
self.removeWorklist(self.checked_workflow,
['guard_expression_worklist'])
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