From 7f141eaf9c2f98276862f893d08497c8922aff27 Mon Sep 17 00:00:00 2001
From: Kazuhiko Shiozaki <kazuhiko@nexedi.com>
Date: Tue, 26 Jan 2010 09:26:48 +0000
Subject: [PATCH] use new API's TradeModelRule.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@31968 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 .../tests/testERP5SimulationBPMEvaluation.py  | 70 +++++++++++++++++++
 1 file changed, 70 insertions(+)

diff --git a/product/ERP5/tests/testERP5SimulationBPMEvaluation.py b/product/ERP5/tests/testERP5SimulationBPMEvaluation.py
index 7f1d82993b..8374c94fdf 100644
--- a/product/ERP5/tests/testERP5SimulationBPMEvaluation.py
+++ b/product/ERP5/tests/testERP5SimulationBPMEvaluation.py
@@ -111,6 +111,76 @@ if True:
 
   TestBPMEvaluationMixin._createRootTradeRule = _createRootTradeRule
 
+  def _createTradeModelRule(self):
+    rule = self.rule_tool.newContent(portal_type='Trade Model Rule',
+      reference='default_trade_model_rule',
+      test_method_id = ('SimulationMovement_testTradeModelRule',)
+      )
+    # matching providers
+    for category in ('resource',):
+      rule.newContent(
+        portal_type='Category Membership Divergence Tester',
+        title='%s divergence tester' % category,
+        tested_property=category,
+        divergence_provider=False,
+        matching_provider=True)
+    rule.newContent(
+      portal_type='Variation Divergence Tester',
+      title='variation divergence tester',
+      tested_property='variation_property_dict',
+      divergence_provider=False,
+      matching_provider=True)
+
+    # divergence providers
+    for category in ('resource',
+                     'source_section',
+                     'destination_section',
+                     'source',
+                     'source_function',
+                     'destination_function',
+                     'source_project',
+                     'destination_project',
+                     'aggregate',
+                     'price_currency',
+                     'base_contribution',
+                     'base_application',
+                     'source_account',
+                     'destination_account',
+                     ):
+      rule.newContent(
+        portal_type='Category Membership Divergence Tester',
+        title='%s divergence tester' % category,
+        tested_property=category,
+        divergence_provider=True,
+        matching_provider=False)
+    rule.newContent(
+      portal_type='Net Converted Quantity Divergence Tester',
+      title='quantity divergence tester',
+      tested_property='quantity',
+      quantity=0,
+      divergence_provider=True,
+      matching_provider=False)
+    for property_id in ('start_date', 'stop_date'):
+      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)
+    rule.newContent(
+      portal_type='Float Divergence Tester',
+      title='price divergence tester',
+      tested_property='price',
+      quantity=0,
+      divergence_provider=True,
+      matching_provider=False)
+
+    rule.validate()
+    transaction.commit()
+
+  TestBPMEvaluationMixin._createTradeModelRule = _createTradeModelRule
+
   def _createInvoicingRule(self):
     edit_dict = {}
     edit_dict.update(
-- 
2.30.9