[Erp5-report] r31932 kazuhiko - /erp5/trunk/products/ERP5/tests/testERP5Simulation.py

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Jan 25 14:29:23 CET 2010


Author: kazuhiko
Date: Mon Jan 25 14:29:21 2010
New Revision: 31932

URL: http://svn.erp5.org?rev=31932&view=rev
Log:
create invoice transaction rule from scratch in tests.

Modified:
    erp5/trunk/products/ERP5/tests/testERP5Simulation.py

Modified: erp5/trunk/products/ERP5/tests/testERP5Simulation.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testERP5Simulation.py?rev=31932&r1=31931&r2=31932&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testERP5Simulation.py [utf8] (original)
+++ erp5/trunk/products/ERP5/tests/testERP5Simulation.py [utf8] Mon Jan 25 14:29:21 2010
@@ -69,8 +69,55 @@
         account.setGap(account_gap)
         account.setAccountType(account_type)
         portal.portal_workflow.doActionFor(account, 'validate_action')
-
-    invoice_rule = portal.portal_rules.new_invoice_transaction_rule
+    invoice_rule = portal.portal_rules.newContent(
+                        portal_type='Invoice Transaction Rule',
+                        reference='default_invoice_transaction_rule',
+                        title='Transaction Rule',
+                        test_method_id=
+                        'SimulationMovement_testInvoiceTransactionRule',
+                        version=100)
+    # matching provider for source and destination
+    for category in ('resource', 'source', 'destination',
+                     'destination_total_asset_price',
+                     'source_total_asset_price'):
+      invoice_rule.newContent(
+        portal_type='Category Membership Divergence Tester',
+        title='%s divergence tester' % category,
+        tested_property=category,
+        divergence_provider=False,
+        matching_provider=True)
+    # non-matching/non-divergence provider quantity divergence tester
+    # (i.e. only used for expand)
+    invoice_rule.newContent(
+      portal_type='Net Converted Quantity Divergence Tester',
+      title='quantity divergence tester',
+      tested_property='quantity',
+      quantity=0,
+      divergence_provider=False,
+      matching_provider=False)
+    # divergence provider for date
+    for property_id in ('start_date', 'stop_date'):
+      invoice_rule.newContent(
+        portal_type='DateTime Divergence Tester',
+        title='%s divergence tester' % property_id,
+        tested_property=property_id,
+        quantity=0,
+        divergence_provider=True,
+        matching_provider=False)
+    for category in ('source_administration', 'source_decision', 'source_function', 'source_payment', 'source_project', 'source_section', 'destination_administration', 'destination_decision', 'destination_function', 'destination_payment', 'destination_project', 'destination_section'):
+      invoice_rule.newContent(
+        portal_type='Category Membership Divergence Tester',
+        title='%s divergence tester' % category,
+        tested_property=category,
+        divergence_provider=True,
+        matching_provider=False)
+    invoice_rule.newContent(
+      portal_type='Float Divergence Tester',
+      title='price divergence tester',
+      tested_property='price',
+      quantity=0,
+      divergence_provider=True,
+      matching_provider=False)
     if invoice_rule.getValidationState() == 'validated':
       invoice_rule.invalidate()
 




More information about the Erp5-report mailing list