Commit 844cde4f authored by Julien Muchembled's avatar Julien Muchembled

Run testProject with legacy simulation + several fixes to testOpenOrder and testProject

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@40003 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 303d21dd
......@@ -42,16 +42,17 @@ class TestOpenOrder(ERP5TypeTestCase):
return ('erp5_base',
'erp5_pdm',
'erp5_simulation',
'erp5_trade',
'erp5_open_trade',
)
'erp5_simulation_test')
def afterSetUp(self):
if getattr(self.portal, '_run_after_setup', None) is not None:
return
self.portal.portal_rules.default_open_order_rule.validate()
self.portal.portal_rules.default_order_rule.validate()
self.getRule(reference='default_open_order_rule').validate()
self.getRule(reference='default_order_rule').validate()
self.portal.portal_categories.base_amount.newContent(
id='taxable',
......@@ -267,7 +268,8 @@ class TestOpenOrder(ERP5TypeTestCase):
applied_rule = open_sale_order.getCausalityRelatedValue(portal_type='Applied Rule')
self.assertEqual(len(applied_rule.objectIds()), 0)
self.portal.portal_rules.default_open_order_rule.expand(
open_order_rule = self.getRule(reference='default_open_order_rule')
open_order_rule.expand(
applied_rule,
calculation_base_date=DateTime(3000,2,9))
......@@ -279,7 +281,7 @@ class TestOpenOrder(ERP5TypeTestCase):
self.assertEqual(applied_rule['1'].getStopDate(), DateTime(3000,2,11,10,0))
open_sale_order.setForecastingTermDayCount(10)
self.portal.portal_rules.default_open_order_rule.expand(
open_order_rule.expand(
applied_rule,
calculation_base_date=DateTime(3000,2,9))
......@@ -290,7 +292,7 @@ class TestOpenOrder(ERP5TypeTestCase):
self.assertEqual(applied_rule['2'].getStartDate(), DateTime(3000,2,17,10,0))
self.assertEqual(applied_rule['2'].getStopDate(), DateTime(3000,2,18,10,0))
self.portal.portal_rules.default_open_order_rule.expand(
open_order_rule.expand(
applied_rule,
calculation_base_date=DateTime(3000,3,1))
......@@ -307,7 +309,7 @@ class TestOpenOrder(ERP5TypeTestCase):
(DateTime(3000,3,10,10,0), DateTime(3000,3,11,10,0))
])
self.portal.portal_rules.default_open_order_rule.expand(
open_order_rule.expand(
applied_rule,
calculation_base_date=DateTime(3000,3,1))
......@@ -317,7 +319,7 @@ class TestOpenOrder(ERP5TypeTestCase):
self.assertEqual(len(applied_rule.objectIds()), 5)
self.portal.sale_trade_condition_module.main_trade_condition.setExpirationDate(DateTime(3000,3,22))
self.portal.portal_rules.default_open_order_rule.expand(
open_order_rule.expand(
applied_rule,
calculation_base_date=DateTime(3000,3,30))
......
......@@ -32,11 +32,16 @@ import unittest
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
import transaction
from DateTime import DateTime
from Products.ERP5.tests.utils import newSimulationExpectedFailure
class TestProject(ERP5TypeTestCase):
""" Test for Project API and scripts and forms
used for Project Document.
"""
business_process = 'business_process_module/erp5_default_business_process'
rule_id_list = ('new_order_root_simulation_rule',
'new_delivery_simulation_rule')
def getTitle(self):
return "Project"
......@@ -44,16 +49,16 @@ class TestProject(ERP5TypeTestCase):
"""Returns list of BT to be installed."""
return ('erp5_base',
'erp5_pdm',
'erp5_simulation',
'erp5_trade',
'erp5_project',)
'erp5_project',
'erp5_simulation_test')
def afterSetUp(self):
"""Setup the fixture.
"""
self.portal = self.getPortal()
for rule_id in ['default_order_rule', 'default_delivery_rule']:
rule = getattr(self.portal.portal_rules, rule_id)
for rule_id in self.rule_id_list:
rule = self.portal.portal_rules[rule_id]
if rule.getValidationState() == 'draft':
rule.validate()
......@@ -107,6 +112,7 @@ class TestProject(ERP5TypeTestCase):
transaction.commit()
self.tic()
@newSimulationExpectedFailure
def testProject_getSourceProjectRelatedTaskReportList(self):
"""
Basic Test if the script behaviour as expected.
......@@ -117,6 +123,7 @@ class TestProject(ERP5TypeTestCase):
task = task_module.newContent(portal_type='Task',
title='Task 1',
specialise=self.business_process,
task_line_quantity=3,
resource='product_module/development',
source='organisation_module/Organisation_1',
......
......@@ -28,11 +28,18 @@
from Products.ERP5Legacy.tests import Legacy_getBusinessTemplateList
test_suite_list = []
from Products.ERP5.tests.testProject import *
test_suite_list.append(test_suite)
from Products.ERP5.tests.testTask import *
test_suite_list.append(test_suite)
from Products.ERP5.tests.testTaskReportDivergence import *
test_suite_list.append(test_suite)
# WARNING: TestProject is tested with rules using 'order' category
TestProject.rule_id_list = 'default_order_rule', 'default_delivery_rule'
TestProject.business_process = None
Legacy_getBusinessTemplateList(TestProject)
TestTaskMixin.business_process = None
Legacy_getBusinessTemplateList(TestTaskMixin)
......
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