[Erp5-report] r40003 jm - in /erp5/trunk/products: ERP5/tests/ ERP5Legacy/tests/

nobody at svn.erp5.org nobody at svn.erp5.org
Sun Nov 7 04:11:45 CET 2010


Author: jm
Date: Sun Nov  7 04:11:44 2010
New Revision: 40003

URL: http://svn.erp5.org?rev=40003&view=rev
Log:
Run testProject with legacy simulation + several fixes to testOpenOrder and testProject

Added:
    erp5/trunk/products/ERP5Legacy/tests/testLegacyProjectAndTask.py
      - copied, changed from r40002, erp5/trunk/products/ERP5Legacy/tests/testLegacyTask.py
Removed:
    erp5/trunk/products/ERP5Legacy/tests/testLegacyTask.py
Modified:
    erp5/trunk/products/ERP5/tests/testOpenOrder.py
    erp5/trunk/products/ERP5/tests/testProject.py

Modified: erp5/trunk/products/ERP5/tests/testOpenOrder.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testOpenOrder.py?rev=40003&r1=40002&r2=40003&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testOpenOrder.py [utf8] (original)
+++ erp5/trunk/products/ERP5/tests/testOpenOrder.py [utf8] Sun Nov  7 04:11:44 2010
@@ -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))
 

Modified: erp5/trunk/products/ERP5/tests/testProject.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testProject.py?rev=40003&r1=40002&r2=40003&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testProject.py [utf8] (original)
+++ erp5/trunk/products/ERP5/tests/testProject.py [utf8] Sun Nov  7 04:11:44 2010
@@ -32,28 +32,33 @@ 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"
 
   def getBusinessTemplateList(self):
     """Returns list of BT to be installed."""
-    return ('erp5_base', 
-            'erp5_pdm', 
-            'erp5_trade', 
-            'erp5_project',)
+    return ('erp5_base',
+            'erp5_pdm',
+            'erp5_simulation',
+            'erp5_trade',
+            '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',

Copied: erp5/trunk/products/ERP5Legacy/tests/testLegacyProjectAndTask.py (from r40002, erp5/trunk/products/ERP5Legacy/tests/testLegacyTask.py)
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Legacy/tests/testLegacyProjectAndTask.py?p2=erp5/trunk/products/ERP5Legacy/tests/testLegacyProjectAndTask.py&p1=erp5/trunk/products/ERP5Legacy/tests/testLegacyTask.py&r1=40002&r2=40003&rev=40003&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Legacy/tests/testLegacyTask.py [utf8] (original)
+++ erp5/trunk/products/ERP5Legacy/tests/testLegacyProjectAndTask.py [utf8] Sun Nov  7 04:11:44 2010
@@ -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)
 

Removed: erp5/trunk/products/ERP5Legacy/tests/testLegacyTask.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Legacy/tests/testLegacyTask.py?rev=40002&view=auto
==============================================================================
--- erp5/trunk/products/ERP5Legacy/tests/testLegacyTask.py [utf8] (original)
+++ erp5/trunk/products/ERP5Legacy/tests/testLegacyTask.py (removed)
@@ -1,43 +0,0 @@
-# -*- 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.
-#
-##############################################################################
-
-from Products.ERP5Legacy.tests import Legacy_getBusinessTemplateList
-
-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)
-
-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




More information about the Erp5-report mailing list