Commit fc4919e2 authored by Sebastien Robin's avatar Sebastien Robin

testTaskReporting: make this test able to run on live instance without deletions

parent e57eb7c1
...@@ -31,15 +31,11 @@ from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5ReportTestCase ...@@ -31,15 +31,11 @@ from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5ReportTestCase
from Products.ERP5Type.tests.utils import reindex from Products.ERP5Type.tests.utils import reindex
from DateTime import DateTime from DateTime import DateTime
class TestTaskReporting(ERP5ReportTestCase): class TestTaskReportingMixin(ERP5ReportTestCase):
"""Test Task Reporting
"""
business_process = \ business_process = \
'business_process_module/erp5_default_task_business_process' 'business_process_module/erp5_default_task_business_process'
def getTitle(self):
return "Task Reporting"
def getBusinessTemplateList(self): def getBusinessTemplateList(self):
"""Returns list of BT to be installed.""" """Returns list of BT to be installed."""
return ('erp5_core_proxy_field_legacy', return ('erp5_core_proxy_field_legacy',
...@@ -84,13 +80,13 @@ class TestTaskReporting(ERP5ReportTestCase): ...@@ -84,13 +80,13 @@ class TestTaskReporting(ERP5ReportTestCase):
id='Organisation_2') id='Organisation_2')
# create persons # create persons
if not self.portal.organisation_module.has_key('Person_1'): if not self.portal.person_module.has_key('Person_1'):
org = self.portal.person_module.newContent( org = self.portal.person_module.newContent(
portal_type='Person', portal_type='Person',
reference='Person_1', reference='Person_1',
title='Person_1', title='Person_1',
id='Person_1') id='Person_1')
if not self.portal.organisation_module.has_key('Person_2'): if not self.portal.person_module.has_key('Person_2'):
org = self.portal.person_module.newContent( org = self.portal.person_module.newContent(
portal_type='Person', portal_type='Person',
reference='Person_2', reference='Person_2',
...@@ -112,7 +108,7 @@ class TestTaskReporting(ERP5ReportTestCase): ...@@ -112,7 +108,7 @@ class TestTaskReporting(ERP5ReportTestCase):
project.newContent(portal_type='Project Line', project.newContent(portal_type='Project Line',
id='Line_2', id='Line_2',
title='Line_2') title='Line_2')
if not self.portal.organisation_module.has_key('Project_2'): if not self.portal.project_module.has_key('Project_2'):
project = self.portal.project_module.newContent( project = self.portal.project_module.newContent(
portal_type='Project', portal_type='Project',
reference='Project_2', reference='Project_2',
...@@ -152,18 +148,28 @@ class TestTaskReporting(ERP5ReportTestCase): ...@@ -152,18 +148,28 @@ class TestTaskReporting(ERP5ReportTestCase):
# and all this available to catalog # and all this available to catalog
self.tic() self.tic()
# Patch getInventoryList to only take movement created in the test
self.simulation_class = self.portal.portal_simulation.__class__
self.initial_getInventoryList = initial_getInventoryList = \
self.simulation_class.getInventoryList
now = DateTime()
def getInventoryList(self, **kw):
return initial_getInventoryList(self,
modification_date={"query":now, "range":"min"}, **kw)
self.simulation_class.getInventoryList = getInventoryList
def beforeTearDown(self): def beforeTearDown(self):
"""Remove all documents.
""" """
self.abort() remove patches
portal = self.portal """
portal.task_module.manage_delObjects( self.simulation_class.getInventoryList = self.initial_getInventoryList
list(portal.task_module.objectIds()))
portal.task_report_module.manage_delObjects( class TestTaskReporting(TestTaskReportingMixin):
list(portal.task_report_module.objectIds())) """Test Task Reporting
portal.portal_simulation.manage_delObjects( """
list(portal.portal_simulation.objectIds())) def getTitle(self):
self.tic() return "Task Reporting"
def testProjectMontlyReport(self): def testProjectMontlyReport(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