Commit ec602817 authored by Julien Muchembled's avatar Julien Muchembled

Fix testTask and add new testLegacyTask

git-svn-id: https://svn.erp5.org/repos/public/erp5/sandbox/amount_generator@38816 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 1c6f15b2
...@@ -51,6 +51,7 @@ class TestTaskMixin: ...@@ -51,6 +51,7 @@ class TestTaskMixin:
task_report_line_portal_type = 'Task Report Line' task_report_line_portal_type = 'Task Report Line'
datetime = DateTime() datetime = DateTime()
task_workflow_id='task_workflow' task_workflow_id='task_workflow'
business_process = 'business_process_module/erp5_default_business_process'
default_task_sequence = '\ default_task_sequence = '\
stepLogin \ stepLogin \
...@@ -234,15 +235,15 @@ class TestTaskMixin: ...@@ -234,15 +235,15 @@ class TestTaskMixin:
""" """
Create a task and fill it with dummy data. Create a task and fill it with dummy data.
""" """
portal = self.getPortal() task_module = self.portal.getDefaultModule(
task_module = portal.getDefaultModule(portal_type=self.task_portal_type) portal_type=self.task_portal_type)
task = task_module.newContent(portal_type=self.task_portal_type) task = task_module.newContent(
portal_type=self.task_portal_type,
title=str(self),
description="This is a very simple task. You can do it quickly.",
specialise=self.business_process)
# Check if no task lines are created at the start # Check if no task lines are created at the start
self.assertEquals(len(task.contentValues()), 0) self.assertEquals(len(task.contentValues()), 0)
task.edit(
title = "Task",
description = "This is a very simple task. You can do it quickly."
)
sequence.edit(task=task) sequence.edit(task=task)
def stepCreateCurrency(self, sequence, **kw) : def stepCreateCurrency(self, sequence, **kw) :
...@@ -309,16 +310,14 @@ class TestTaskMixin: ...@@ -309,16 +310,14 @@ class TestTaskMixin:
""" """
Create a task report. Create a task report.
""" """
portal = self.getPortal() task_report_module = self.portal.getDefaultModule(
task_report_module = portal.getDefaultModule( portal_type=self.task_report_portal_type)
portal_type=self.task_report_portal_type)
task_report = task_report_module.newContent( task_report = task_report_module.newContent(
portal_type=self.task_report_portal_type) portal_type=self.task_report_portal_type,
title=str(self),
specialise=self.business_process)
# Check if no task lines are created at the start # Check if no task lines are created at the start
self.assertEquals(len(task_report.contentValues()), 0) self.assertEquals(len(task_report.contentValues()), 0)
task_report.edit(
title = "Task Report",
)
sequence.edit(task_report = task_report) sequence.edit(task_report = task_report)
def stepFillTaskReportWithData(self, sequence=None, sequence_list=None, **kw): def stepFillTaskReportWithData(self, sequence=None, sequence_list=None, **kw):
...@@ -573,7 +572,7 @@ class TestTask(TestTaskMixin, ERP5TypeTestCase): ...@@ -573,7 +572,7 @@ class TestTask(TestTaskMixin, ERP5TypeTestCase):
stepStartTaskReport \ stepStartTaskReport \
stepFinishTaskReport \ stepFinishTaskReport \
stepCloseTaskReport \ stepCloseTaskReport \
' stepTic'
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
sequence_list.play(self) sequence_list.play(self)
...@@ -591,7 +590,7 @@ class TestTask(TestTaskMixin, ERP5TypeTestCase): ...@@ -591,7 +590,7 @@ class TestTask(TestTaskMixin, ERP5TypeTestCase):
stepStartTaskReport \ stepStartTaskReport \
stepFinishTaskReport \ stepFinishTaskReport \
stepCloseTaskReport \ stepCloseTaskReport \
' stepTic'
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
sequence_list.play(self) sequence_list.play(self)
...@@ -607,7 +606,7 @@ class TestTask(TestTaskMixin, ERP5TypeTestCase): ...@@ -607,7 +606,7 @@ class TestTask(TestTaskMixin, ERP5TypeTestCase):
stepStartTaskReport \ stepStartTaskReport \
stepFinishTaskReport \ stepFinishTaskReport \
stepCloseTaskReport \ stepCloseTaskReport \
' stepTic'
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
sequence_list.play(self) sequence_list.play(self)
...@@ -624,7 +623,7 @@ class TestTask(TestTaskMixin, ERP5TypeTestCase): ...@@ -624,7 +623,7 @@ class TestTask(TestTaskMixin, ERP5TypeTestCase):
stepStartTaskReport \ stepStartTaskReport \
stepFinishTaskReport \ stepFinishTaskReport \
stepCloseTaskReport \ stepCloseTaskReport \
' stepTic'
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
sequence_list.play(self) sequence_list.play(self)
...@@ -653,7 +652,7 @@ class TestTask(TestTaskMixin, ERP5TypeTestCase): ...@@ -653,7 +652,7 @@ class TestTask(TestTaskMixin, ERP5TypeTestCase):
stepStartTaskReport \ stepStartTaskReport \
stepFinishTaskReport \ stepFinishTaskReport \
stepCloseTaskReport \ stepCloseTaskReport \
' stepTic'
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
sequence_list.play(self) sequence_list.play(self)
...@@ -668,7 +667,7 @@ class TestTask(TestTaskMixin, ERP5TypeTestCase): ...@@ -668,7 +667,7 @@ class TestTask(TestTaskMixin, ERP5TypeTestCase):
stepStartTaskReport \ stepStartTaskReport \
stepFinishTaskReport \ stepFinishTaskReport \
stepCloseTaskReport \ stepCloseTaskReport \
' stepTic'
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
simulation_tool = self.getPortal().portal_simulation simulation_tool = self.getPortal().portal_simulation
...@@ -690,9 +689,10 @@ class TestTask(TestTaskMixin, ERP5TypeTestCase): ...@@ -690,9 +689,10 @@ class TestTask(TestTaskMixin, ERP5TypeTestCase):
"""Tests that task reference is set upon creation and coping""" """Tests that task reference is set upon creation and coping"""
if not run: return if not run: return
self.stepLogin() self.stepLogin()
portal = self.getPortal() task_module = self.portal.getDefaultModule(
task_module = portal.getDefaultModule(portal_type=self.task_portal_type) portal_type=self.task_portal_type)
task = task_module.newContent(portal_type=self.task_portal_type) task = task_module.newContent(portal_type=self.task_portal_type,
specialise=self.business_process)
self.assertEqual( self.assertEqual(
task.getReference(), task.getReference(),
......
# -*- coding: utf-8 -*-
##############################################################################
# Copyright (c) 2010 Nexedi SA and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility 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
# guarantees and support are strongly advised 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
##############################################################################
test_suite_list = []
from Products.ERP5.tests.testTask import *
test_suite_list.append(test_suite)
from Products.ERP5.tests.testTaskReportDivergence import *
test_suite_list.append(test_suite)
from Products.ERP5Legacy.tests import Legacy_getBusinessTemplateList
TestTaskMixin.business_process = None
Legacy_getBusinessTemplateList(TestTaskMixin)
def test_suite():
suite = test_suite_list[0]()
for test_suite in test_suite_list[1:]:
suite.addTests(test_suite())
return suite
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