Commit 216c2233 authored by Arnaud Fontaine's avatar Arnaud Fontaine

ZODB Components: erp5_project: Migrate Unit Tests.

parent c8548044
......@@ -186,18 +186,4 @@ class TestMilestoneReporting(MilestoneReportingMixin, ERP5ReportTestCase):
return self.business_template_list
def testMilestoneReport(self):
self.checkMilestoneReport()
class TestOptimisedMilestoneReporting(MilestoneReportingMixin, ERP5ReportTestCase):
"""Same as above, with additionnal business template adding extra
tables in order to do optimisations
"""
def getTitle(self):
return "Optimised Milestone Reporting"
def getBusinessTemplateList(self):
"""Returns list of BT to be installed."""
return self.business_template_list + ('erp5_project_mysql_innodb_catalog',)
def testMilestoneReport(self):
self.checkMilestoneReport(optimised=True)
self.checkMilestoneReport()
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Test Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testMilestoneReporting</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.tests.testMilestoneReporting</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test.erp5.testMilestoneReporting</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Test Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -63,18 +63,18 @@ class TestProject(ERP5TypeTestCase):
# create organisations
if not self.portal.organisation_module.has_key('Organisation_1'):
org = self.portal.organisation_module.newContent(
self.portal.organisation_module.newContent(
title='Organisation_1',
id='Organisation_1')
# create organisations
if not self.portal.organisation_module.has_key('Organisation_2'):
org = self.portal.organisation_module.newContent(
self.portal.organisation_module.newContent(
title='Organisation_2',
id='Organisation_2')
# create project
if not self.portal.project_module.has_key('Project_1'):
project = self.portal.project_module.newContent(
self.portal.project_module.newContent(
portal_type='Project',
reference='Project_1',
title='Project_1',
......@@ -83,7 +83,7 @@ class TestProject(ERP5TypeTestCase):
# Create resources
module = self.portal.product_module
if not module.has_key('development'):
product = module.newContent(
module.newContent(
portal_type='Product',
id='development',
title='Development',
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Test Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testProject</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.tests.testProject</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test.erp5.testProject</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Test Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -34,7 +34,6 @@ from AccessControl.SecurityManagement import newSecurityManager
from DateTime import DateTime
from Products.DCWorkflow.DCWorkflow import ValidationFailed
from Products.ERP5Type.tests.Sequence import SequenceList, Sequence
from Testing.ZopeTestCase.PortalTestCase import PortalTestCase
class TestTaskMixin:
......@@ -113,8 +112,6 @@ class TestTaskMixin:
stepSetTaskReportPriceCurrency \
stepCreateTaskReportLine '
login = PortalTestCase.login
def getBusinessTemplateList(self):
"""
"""
......@@ -280,7 +277,6 @@ class TestTaskMixin:
"""
task = sequence.get('task')
project = sequence.get('project')
resource = sequence.get('resource_list')[0]
organisation_list = sequence.get('organisation_list')
organisation1 = organisation_list[0]
organisation2 = organisation_list[1]
......@@ -302,7 +298,6 @@ class TestTaskMixin:
self.stepSetTaskValues(sequence=sequence,
sequence_list=sequence_list, **kw)
task = sequence.get('task')
project = sequence.get('project')
resource = sequence.get('resource_list')[0]
requirement = sequence.get('requirement')
task.edit(task_line_resource_value = resource,
......@@ -361,7 +356,6 @@ class TestTaskMixin:
Create task report line and fill with dummy data.
"""
resource = sequence.get('resource_list')[0]
portal = self.getPortal()
task_report = sequence.get('task_report')
task_report_line = task_report.newContent(
portal_type=self.task_report_line_portal_type)
......@@ -442,15 +436,15 @@ class TestTaskMixin:
# XXX
# Task line not precisely tested
for task_line in task_content_list:
task_report_resource_list = \
task_report_resource_list = \
[line.getResource() for line in task_report.contentValues()]
task_report_quantity_list = \
task_report_quantity_list = \
[line.getQuantity() for line in task_report.contentValues()]
task_report_price_list = \
task_report_price_list = \
[line.getPrice() for line in task_report.contentValues()]
self.assertTrue(task_line.getResource() in task_report_resource_list)
self.assertTrue(task_line.getQuantity() in task_report_quantity_list)
self.assertTrue(task_line.getPrice() in task_report_price_list)
self.assertTrue(task_line.getResource() in task_report_resource_list)
self.assertTrue(task_line.getQuantity() in task_report_quantity_list)
self.assertTrue(task_line.getPrice() in task_report_price_list)
for task_report_line in task_report.contentValues(portal_type='Task Report Line'):
simulation_movement = task_report_line.getDeliveryRelatedValue()
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Test Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testTask</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.tests.testTask</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test.erp5.testTask</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Test Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -31,7 +31,7 @@ from unittest import expectedFailure
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.Sequence import SequenceList
from testTask import TestTaskMixin
from erp5.component.test.testTask import TestTaskMixin
from Products.ERP5Type.tests.SecurityTestCase import SecurityTestCase
class TestTaskReportDivergenceMixin(TestTaskMixin, SecurityTestCase):
......@@ -290,7 +290,6 @@ class TestTaskReportDivergence(TestTaskReportDivergenceMixin, ERP5TypeTestCase)
"""
Use the divergence API to adopt the decision.
"""
task_report = sequence.get('task_report')
# XXX Check task report solver proposition in UI
def stepCheckTaskReportDates(self, sequence=None, **kw):
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Test Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testTaskReportDivergence</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.tests.testTaskReportDivergence</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test.erp5.testTaskReportDivergence</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Test Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -72,14 +72,14 @@ class TestTaskReportingMixin(ERP5ReportTestCase):
# create organisations
if not self.portal.organisation_module.has_key('Organisation_1'):
org = self.portal.organisation_module.newContent(
self.portal.organisation_module.newContent(
portal_type='Organisation',
reference='Organisation_1',
title='Organisation_1',
id='Organisation_1')
if not self.portal.organisation_module.has_key('Organisation_2'):
org = self.portal.organisation_module.newContent(
self.portal.organisation_module.newContent(
portal_type='Organisation',
reference='Organisation_2',
title='Organisation_2',
......@@ -87,13 +87,13 @@ class TestTaskReportingMixin(ERP5ReportTestCase):
# create persons
if not self.portal.person_module.has_key('Person_1'):
org = self.portal.person_module.newContent(
self.portal.person_module.newContent(
portal_type='Person',
reference='Person_1',
title='Person_1',
id='Person_1')
if not self.portal.person_module.has_key('Person_2'):
org = self.portal.person_module.newContent(
self.portal.person_module.newContent(
portal_type='Person',
reference='Person_2',
title='Person_2',
......@@ -135,7 +135,7 @@ class TestTaskReportingMixin(ERP5ReportTestCase):
# Create resources
module = self.portal.product_module
if not module.has_key('development'):
product = module.newContent(
module.newContent(
portal_type='Product',
id='development',
title='Development',
......@@ -143,7 +143,7 @@ class TestTaskReportingMixin(ERP5ReportTestCase):
quantity_unit='day'
)
if not module.has_key('consulting'):
product = module.newContent(
module.newContent(
portal_type='Product',
id='consulting',
title='Consulting',
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Test Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testTaskReporting</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.tests.testTaskReporting</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test.erp5.testTaskReporting</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Test Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
test.erp5.testMilestoneReporting
test.erp5.testProject
test.erp5.testTask
test.erp5.testTaskReportDivergence
test.erp5.testTaskReporting
\ No newline at end of file
erp5_full_text_mroonga_catalog
erp5_base
erp5_pdm
erp5_simulation
erp5_movement_table_catalog
erp5_configurator_standard_solver
erp5_core_proxy_field_legacy
erp5_simulation_test
erp5_simulation_test_trade_template
\ No newline at end of file
#############################################################################
#
# Copyright 2009 Nexedi SA Contributors. All Rights Reserved.
# Sebastien Robin <seb@nexedi.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5ReportTestCase
from erp5.component.test.testMilestoneReporting import MilestoneReportingMixin
class TestOptimisedMilestoneReporting(MilestoneReportingMixin, ERP5ReportTestCase):
"""Same as above, with additionnal business template adding extra
tables in order to do optimisations
"""
def getTitle(self):
return "Optimised Milestone Reporting"
def getBusinessTemplateList(self):
"""Returns list of BT to be installed."""
return self.business_template_list + ('erp5_project_mysql_innodb_catalog',)
def testMilestoneReport(self):
self.checkMilestoneReport(optimised=True)
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Test Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>testOptimizedMilestoneReporting</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>test.erp5.testOptimizedMilestoneReporting</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Test Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
test.erp5.testOptimizedMilestoneReporting
\ No newline at end of file
erp5_full_text_mroonga_catalog
erp5_trade
erp5_knowledge_pad
erp5_accounting
erp5_base
erp5_pdm
erp5_simulation
erp5_movement_table_catalog
erp5_configurator_standard_trade_template
erp5_configurator_standard_solver
erp5_core_proxy_field_legacy
erp5_simulation_test
erp5_simulation_test_trade_template
erp5_project
\ No newline at end of file
......@@ -26,7 +26,7 @@
##############################################################################
from DateTime import DateTime
from Products.ERP5.tests.testTaskReporting import TestTaskReportingMixin
from erp5.component.test.testTaskReporting import TestTaskReportingMixin
class TestResearchItemSummaryReport(TestTaskReportingMixin):
"""
......
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