[Erp5-report] r40004 jm - in /erp5/trunk: bt5/erp5_simulation_legacy/DocumentTemplateItem/ ...
nobody at svn.erp5.org
nobody at svn.erp5.org
Sun Nov 7 04:12:02 CET 2010
Author: jm
Date: Sun Nov 7 04:12:01 2010
New Revision: 40004
URL: http://svn.erp5.org?rev=40004&view=rev
Log:
New testLegacySimulationRule
Added:
erp5/trunk/products/ERP5Legacy/tests/testLegacySimulationRule.py
Modified:
erp5/trunk/bt5/erp5_simulation_legacy/DocumentTemplateItem/PaymentSimulationRule.py
erp5/trunk/bt5/erp5_simulation_legacy/bt/revision
erp5/trunk/products/ERP5/tests/testAccountingRules.py
erp5/trunk/products/ERP5/tests/testRule.py
Modified: erp5/trunk/bt5/erp5_simulation_legacy/DocumentTemplateItem/PaymentSimulationRule.py
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_simulation_legacy/DocumentTemplateItem/PaymentSimulationRule.py?rev=40004&r1=40003&r2=40004&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_simulation_legacy/DocumentTemplateItem/PaymentSimulationRule.py [utf8] (original)
+++ erp5/trunk/bt5/erp5_simulation_legacy/DocumentTemplateItem/PaymentSimulationRule.py [utf8] Sun Nov 7 04:12:01 2010
@@ -97,13 +97,17 @@ class PaymentSimulationRule(Rule, Predic
if cell is not None : # else, we do nothing
for payment_condition in payment_condition_list:
- aggregated_ammount_list = payment_condition.getAggregatedAmountList(
- input_movement, movement_list=[input_movement])
- assert len(aggregated_ammount_list) == 1
- aggregated_ammount = aggregated_ammount_list[0]
- start_date = aggregated_ammount.getStartDate()
- stop_date = aggregated_ammount.getStopDate()
- quantity = aggregated_ammount.getQuantity()
+ # XXX
+ if (payment_condition.getCalculationScript(input_movement) is not None
+ or payment_condition.getEfficiency() != 1):
+ raise NotImplementedError
+ #amount, = payment_condition.getAggregatedAmountList((input_movement,))
+ #start_date = amount.getStartDate() # does it depend on any property
+ #stop_date = amount.getStopDate() # of payment_condition ?
+ #quantity = amount.getQuantity()
+ start_date = input_movement.getStartDate()
+ stop_date = input_movement.getStopDate()
+ quantity = input_movement.getTotalPrice() * payment_condition.getQuantity(1)
payment_mode = payment_condition.getPaymentMode()
# one for payable
Modified: erp5/trunk/bt5/erp5_simulation_legacy/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_simulation_legacy/bt/revision?rev=40004&r1=40003&r2=40004&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_simulation_legacy/bt/revision [utf8] (original)
+++ erp5/trunk/bt5/erp5_simulation_legacy/bt/revision [utf8] Sun Nov 7 04:12:01 2010
@@ -1 +1 @@
-2
\ No newline at end of file
+3
\ No newline at end of file
Modified: erp5/trunk/products/ERP5/tests/testAccountingRules.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testAccountingRules.py?rev=40004&r1=40003&r2=40004&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testAccountingRules.py [utf8] (original)
+++ erp5/trunk/products/ERP5/tests/testAccountingRules.py [utf8] Sun Nov 7 04:12:01 2010
@@ -47,6 +47,7 @@ import transaction
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.Sequence import SequenceList
+from Products.ERP5.tests.utils import newSimulationExpectedFailure
from Products.ERP5.Document.MirrorMovementGroup import _isMirrored
from Testing import ZopeTestCase
@@ -1662,6 +1663,7 @@ class TestAccountingRules(TestAccounting
self.failUnless(self.getProductModule() != None)
self.failUnless(self.getCurrencyModule() != None)
+ @newSimulationExpectedFailure
def test_02_UpdateInvoiceTransactionRuleMatrix(self, quiet=QUIET,
run=RUN_ALL_TESTS):
""" test edition of matrix and rule.
@@ -1689,6 +1691,7 @@ class TestAccountingRules(TestAccounting
stepCheckRestoreOriginalPredicates
""", quiet=quiet)
+ @newSimulationExpectedFailure
def test_03_invoiceTransactionRule_getMatchingCell(self,
quiet=QUIET, run=RUN_ALL_TESTS):
""" test predicates for the cells of invoice transaction rule
@@ -1719,6 +1722,7 @@ class TestAccountingRules(TestAccounting
stepCheckNotMatchableInvoiceMovements
""", quiet=quiet)
+ @newSimulationExpectedFailure
def test_04_SimpleInvoice(self, quiet=QUIET, run=RUN_ALL_TESTS):
""" Simple Invoice.
Try to expand an invoice containing only one simple Invoice Line.
@@ -1760,6 +1764,7 @@ class TestAccountingRules(TestAccounting
stepCheckPaymentLinesCreatedForSimpleInvoice
""", quiet=quiet )
+ @newSimulationExpectedFailure
def test_04b_SimpleInvoiceConfirm(self, quiet=QUIET, run=RUN_ALL_TESTS):
""" Same test as SimpleInvoice but directly confirm the invoice
without planning it """
@@ -1795,6 +1800,7 @@ class TestAccountingRules(TestAccounting
stepRebuildAndCheckNothingIsCreated
""", quiet=quiet )
+ @newSimulationExpectedFailure
def test_04c_SimpleInvoiceTwoLines(self, quiet=QUIET, run=RUN_ALL_TESTS):
""" Simple Invoice, 2 lines.
Same test as SimpleInvoice but use 2 lines of quantity 5 instead of
@@ -1832,6 +1838,7 @@ class TestAccountingRules(TestAccounting
stepRebuildAndCheckNothingIsCreated
""", quiet=quiet )
+ @newSimulationExpectedFailure
def test_04d_SimpleInvoiceTwoCells(self, quiet=QUIET, run=RUN_ALL_TESTS):
""" Simple Invoice, 2 cells.
Same test as SimpleInvoice but use 2 cells of quantity 5 instead of
@@ -1870,6 +1877,7 @@ class TestAccountingRules(TestAccounting
""", quiet=quiet )
# next 5 tests will check update of applied rules.
+ @newSimulationExpectedFailure
def test_05a_SimpleInvoiceReExpandAddLine(self, quiet=QUIET,
run=RUN_ALL_TESTS):
""" Add a new line then updateAppliedRule.
@@ -1912,6 +1920,7 @@ class TestAccountingRules(TestAccounting
stepRebuildAndCheckNothingIsCreated
""", quiet=quiet )
+ @newSimulationExpectedFailure
def test_05b_SimpleInvoiceReExpandEditLine(self, quiet=QUIET,
run = RUN_ALL_TESTS):
""" Tests that editing a line updates simulation correctly """
@@ -1950,6 +1959,7 @@ class TestAccountingRules(TestAccounting
stepRebuildAndCheckNothingIsCreated
""", quiet=quiet )
+ @newSimulationExpectedFailure
def test_05c_SimpleInvoiceReExpandDeleteLine(
self, quiet=QUIET, run=RUN_ALL_TESTS):
""" Tests that removing a line updates simulation correctly """
@@ -1990,6 +2000,7 @@ class TestAccountingRules(TestAccounting
stepRebuildAndCheckNothingIsCreated
""", quiet=quiet )
+ @newSimulationExpectedFailure
def test_05d_SimpleInvoiceReExpandCreateCell(self, quiet=QUIET,
run=RUN_ALL_TESTS):
""" Tests that replacing a line by cells updates simulation correctly """
@@ -2028,6 +2039,7 @@ class TestAccountingRules(TestAccounting
stepRebuildAndCheckNothingIsCreated
""", quiet=quiet)
+ @newSimulationExpectedFailure
def test_05e_SimpleInvoiceExpandManyTimes(
self, quiet=QUIET, run=RUN_ALL_TESTS):
""" Tests that updating an applied rule many times doesn't break the
@@ -2071,6 +2083,7 @@ class TestAccountingRules(TestAccounting
stepRebuildAndCheckNothingIsCreated
""", quiet=quiet )
+ @newSimulationExpectedFailure
def test_06_MultiLineInvoice(self, quiet=QUIET, run=RUN_ALL_TESTS):
""" Multiple lines invoice.
Try to expand an invoice containing multiples Invoice Line.
@@ -2120,6 +2133,7 @@ class TestAccountingRules(TestAccounting
# quantity from sum of receivable movement
# link to sale invoice
+ @newSimulationExpectedFailure
def test_planning_invoice_creates_simulation(self, quiet=QUIET):
# http://mail.nexedi.com/pipermail/erp5-dev/2008-June/001969.html
self.playSequence("""
Modified: erp5/trunk/products/ERP5/tests/testRule.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testRule.py?rev=40004&r1=40003&r2=40004&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testRule.py [utf8] (original)
+++ erp5/trunk/products/ERP5/tests/testRule.py [utf8] Sun Nov 7 04:12:01 2010
@@ -31,7 +31,8 @@ import transaction
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.utils import createZODBPythonScript
-from testOrder import TestOrderMixin
+from Products.ERP5.tests.testOrder import TestOrderMixin
+from Products.ERP5.tests.utils import newSimulationExpectedFailure
class TestRuleMixin(TestOrderMixin):
"""
@@ -108,6 +109,7 @@ class TestRule(TestRuleMixin, ERP5TypeTe
run_all_test = 1
quiet = 0
+ @newSimulationExpectedFailure
def test_01_ValidatedRuleWithNoScript(self, quiet=quiet, run=run_all_test):
"""
test that when a rule is validated, but has no script it will not apply
@@ -124,6 +126,7 @@ class TestRule(TestRuleMixin, ERP5TypeTe
validation_state="validated")[0][0], 1)
self.assertEquals(len(self.getRuleTool().searchRuleList(self.pl)), 0)
+ @newSimulationExpectedFailure
def test_02_WrongTestMethod(self, quiet=quiet, run=run_all_test):
"""
test that when a rule's test method returns False, it will not apply
@@ -144,6 +147,7 @@ class TestRule(TestRuleMixin, ERP5TypeTe
validation_state="validated")[0][0], 1)
self.assertEquals(len(self.getRuleTool().searchRuleList(self.pl)), 0)
+ @newSimulationExpectedFailure
def test_03_GoodTestMethod(self, quiet=quiet, run=run_all_test):
"""
test that when a rule's test method returns True, it will apply
@@ -164,6 +168,7 @@ class TestRule(TestRuleMixin, ERP5TypeTe
validation_state="validated")[0][0], 1)
self.assertEquals(len(self.getRuleTool().searchRuleList(self.pl)), 1)
+ @newSimulationExpectedFailure
def test_04_NotValidatedRule(self, quiet=quiet, run=run_all_test):
"""
test that when a rule is not validated, it will not apply, even if it has
@@ -186,6 +191,7 @@ class TestRule(TestRuleMixin, ERP5TypeTe
validation_state="validated")[0][0], 0)
self.assertEquals(len(self.getRuleTool().searchRuleList(self.pl)), 0)
+ @newSimulationExpectedFailure
def test_06_WrongDateRange(self, quiet=quiet, run=run_all_test):
"""
test that when a rule is validated but does not have correct date range,
@@ -209,6 +215,7 @@ class TestRule(TestRuleMixin, ERP5TypeTe
validation_state="validated")[0][0], 1)
self.assertEquals(len(self.getRuleTool().searchRuleList(self.pl)), 0)
+ @newSimulationExpectedFailure
def test_07_GoodDateRange(self, quiet=quiet, run=run_all_test):
"""
test that when a rule is validated and has a correct date range, it will
@@ -232,6 +239,7 @@ class TestRule(TestRuleMixin, ERP5TypeTe
validation_state="validated")[0][0], 1)
self.assertEquals(len(self.getRuleTool().searchRuleList(self.pl)), 1)
+ @newSimulationExpectedFailure
def test_08_updateAppliedRule(self, quiet=quiet, run=run_all_test):
"""
test that when updateAppliedRule is called, the rule with the correct
@@ -286,6 +294,7 @@ class TestRule(TestRuleMixin, ERP5TypeTe
self.assertEquals(self.pl.getCausalityRelatedValue().getSpecialise(),
delivery_rule_1.getRelativeUrl())
+ @newSimulationExpectedFailure
def test_09_expandTwoRules(self, quiet=quiet, run=run_all_test):
"""
test that when expand is called on a simulation movement, if two rules
@@ -365,6 +374,7 @@ class TestRule(TestRuleMixin, ERP5TypeTe
self.assertEquals(applied_rule.getSpecialise(),
invoicing_rule_1.getRelativeUrl())
+ @newSimulationExpectedFailure
def test_10_expandAddsRule(self, quiet=quiet, run=run_all_test):
"""
test that if a rule didn't match previously, and does now, it should apply
@@ -467,6 +477,7 @@ class TestRule(TestRuleMixin, ERP5TypeTe
invoicing_rule_2.getRelativeUrl())
+ @newSimulationExpectedFailure
def test_11_expandRemovesRule(self, quiet=quiet, run=run_all_test):
"""
test that if a rule matched previously and does not anymore, it should be
@@ -597,6 +608,7 @@ class TestRule(TestRuleMixin, ERP5TypeTe
sub_movement = applied_rule.objectValues()[0]
self.assertEquals(sub_movement.getDelivery(), self.pl.line.getRelativeUrl())
+ @newSimulationExpectedFailure
def test_12_expandReplacesRule(self, quiet=quiet, run=run_all_test):
"""
test that if a rule matched previously and does not anymore, and another
Added: erp5/trunk/products/ERP5Legacy/tests/testLegacySimulationRule.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Legacy/tests/testLegacySimulationRule.py?rev=40004&view=auto
==============================================================================
--- erp5/trunk/products/ERP5Legacy/tests/testLegacySimulationRule.py (added)
+++ erp5/trunk/products/ERP5Legacy/tests/testLegacySimulationRule.py [utf8] Sun Nov 7 04:12:01 2010
@@ -0,0 +1,35 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+# Copyright (c) 2010 Nexedi SA and Contributors. All Rights Reserved.
+# Julien Muchembled <jm at nexedi.com>
+#
+# 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.
+#
+##############################################################################
+
+import sys
+from Products.ERP5Legacy.tests import testLegacyRuleOrder
+sys.modules['Products.ERP5.tests.testOrder'] = testLegacyRuleOrder
+
+from Products.ERP5Legacy.tests import Legacy_getBusinessTemplateList
+from Products.ERP5.tests.testRule import *
+Legacy_getBusinessTemplateList(TestRuleMixin)
More information about the Erp5-report
mailing list