From f707ab533eaaa785085d19c67bbf74bc79715992 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com> Date: Wed, 28 Oct 2009 10:27:46 +0000 Subject: [PATCH] test of a task with no price currency and no price on the task line git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@30055 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5/tests/testTask.py | 44 +++++++++++++++++++++++++++++++--- 1 file changed, 41 insertions(+), 3 deletions(-) diff --git a/product/ERP5/tests/testTask.py b/product/ERP5/tests/testTask.py index 242336d6c9..2cac5b671d 100644 --- a/product/ERP5/tests/testTask.py +++ b/product/ERP5/tests/testTask.py @@ -67,6 +67,20 @@ class TestTaskMixin: stepTic \ stepSetTaskReport ' + default_task_no_price_sequence = '\ + stepLogin \ + stepCreateOrganisation \ + stepCreateOrganisation \ + stepCreateResource \ + stepCreateProject \ + stepCreateRequirement \ + stepCreateSimpleTask \ + stepFillTaskWithData \ + stepConfirmTask \ + stepTic \ + stepSetTaskReport ' + + default_task_sequence_two_lines = '\ stepLogin \ stepCreateOrganisation \ @@ -245,9 +259,7 @@ class TestTaskMixin: def stepSetTaskPriceCurrency(self, sequence, **kw) : """Set the price currency of the task. - This step is not necessary. - TODO : - include a test without this step. - - include a test with this step late. + TODO : include a test with this step late. """ currency = sequence.get('currency') task = sequence.get('task') @@ -443,6 +455,14 @@ class TestTaskMixin: task_report = sequence.get('task_report') self.assertEqual(task_report.getCausalityState(), 'solved') + def stepVerifyTaskReportNoPrice(self, sequence=None, + sequence_list=None, **kw): + task_report = sequence.get('task_report') + self.assertEqual(None, task_report.getPriceCurrency()) + self.assertEqual(1, len(task_report.getMovementList())) + task_report_line = task_report.getMovementList()[0] + self.assertEqual(None, task_report_line.getPrice()) + def modifyState(self, object_name, transition_name, sequence=None, sequence_list=None): object_value = sequence.get(object_name) @@ -549,6 +569,24 @@ class TestTask(TestTaskMixin, ERP5TypeTestCase): ' sequence_list.addSequenceString(sequence_string) sequence_list.play(self) + + def test_01_testTaskNoPrice(self, quiet=0, run=run_all_test): + """ + Test creation of task and (automatic) task_report when no price is + defined on the task + """ + if not run: return + self.default_price = None + sequence_list = SequenceList() + sequence_string = self.default_task_no_price_sequence + '\ + stepVerifyGeneratedByBuilderTaskReport \ + stepVerifyTaskReportNoPrice \ + stepStartTaskReport \ + stepFinishTaskReport \ + stepCloseTaskReport \ + ' + sequence_list.addSequenceString(sequence_string) + sequence_list.play(self) def test_02_testMultipleLineTaskBasicUseCase(self, quiet=0, run=run_all_test): """ -- 2.30.9