From 06422e716c193b44951b80f940112de1cf1e82d7 Mon Sep 17 00:00:00 2001 From: Kazuhiko Shiozaki <kazuhiko@nexedi.com> Date: Mon, 1 Feb 2010 11:37:00 +0000 Subject: [PATCH] merge these two experimental tests. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@32128 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5/tests/testBPMEvaluation.py | 251 +++++++++++------ .../tests/testERP5SimulationBPMEvaluation.py | 256 ------------------ 2 files changed, 169 insertions(+), 338 deletions(-) delete mode 100644 product/ERP5/tests/testERP5SimulationBPMEvaluation.py diff --git a/product/ERP5/tests/testBPMEvaluation.py b/product/ERP5/tests/testBPMEvaluation.py index 0c179121a7..9970fdf99b 100644 --- a/product/ERP5/tests/testBPMEvaluation.py +++ b/product/ERP5/tests/testBPMEvaluation.py @@ -58,7 +58,7 @@ class TestBPMEvaluationMixin(TestBPMMixin): def getBusinessTemplateList(self): return TestBPMMixin.getBusinessTemplateList(self) + ('erp5_bpm', - 'erp5_administration') + 'erp5_administration', 'erp5_simulation',) def afterSetUp(self): TestBPMMixin.afterSetUp(self) @@ -91,29 +91,59 @@ class TestBPMEvaluationMixin(TestBPMMixin): edit_dict = {} edit_dict.update( trade_phase = 'default/delivery', - expandable_property = ('aggregate_list', 'base_application_list', - 'base_contribution_list', 'causality_list', 'description', - 'destination_account_list', 'destination_function_list', - 'destination_list', 'destination_section_list', 'price', - 'price_currency_list', 'quantity', 'quantity_unit_list', - 'resource_list', 'source_account_list', 'source_function_list', - 'source_list', 'source_section_list', 'start_date', 'stop_date', - 'variation_category_list', 'variation_property_dict'), - matching_property = ('resource_list', 'variation_category_list', - 'variation_property_dict', 'order_list') ) edit_dict.update(**kw) rule = self.rule_tool.newContent(**edit_dict) - rule.newContent(portal_type='Category Divergence Tester', - tested_property = ('source_section_list | Source Section', - 'resource_list | Resource', - 'destination_section_list | Destination Section', - 'source_list | Source', 'destination_list | Destination', - 'aggregate_list | Aggregate')) - rule.newContent(portal_type='Property Divergence Tester', - tested_property = ('start_date | Start Date', - 'stop_date | Stop Date')) - rule.newContent(portal_type='Quantity Divergence Tester') + + # matching providers + for category in ('resource', 'order'): + 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 ('source_section', + 'resource', + 'destination_section', + 'source', + 'aggregate'): + 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) return rule @@ -130,41 +160,69 @@ class TestBPMEvaluationMixin(TestBPMMixin): transaction.commit() def _createTradeModelRule(self): - edit_dict = {} - edit_dict.update( - ) rule = self.rule_tool.newContent(portal_type='Trade Model Rule', reference='default_trade_model_rule', - expandable_property = ('delivery_mode_list', 'incoterm_list', - 'source_list', 'destination_list', 'source_section_list', - 'destination_section_list', 'source_decision_list', - 'destination_decision_list', 'source_administration_list', - 'destination_administration_list', 'price_currency_list', - 'resource_list', 'aggregate_list', 'source_function_list', - 'destination_function_list', 'source_account_list', - 'destination_account_list', 'description', - 'destination_payment_list', 'source_payment_list'), test_method_id = ('SimulationMovement_testTradeModelRule',) ) - rule.newContent(portal_type='Category Divergence Tester', - tested_property = ('resource_list | Resource', - 'source_section_list | Source Section', - 'destination_section_list | Destination Section', - 'source_list | Source', 'destination_list | Destination', - 'source_function_list | Source Function', - 'destination_function_list | Destination Function', - 'source_project_list | Source Project', - 'destination_project_list | Destination Project', - 'aggregate_list | Aggregate', - 'price_currency_list | Price Currency', - 'base_contribution_list | Base Contribution', - 'base_application_list | Base Application', - 'source_account_list | Source Account', - 'destination_account_list | Destination Account')) - rule.newContent(portal_type='Property Divergence Tester', - tested_property = ('start_date | Start Date', - 'stop_date | Stop Date', 'price | Price')) - rule.newContent(portal_type='Quantity Divergence Tester') + # 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() @@ -187,38 +245,67 @@ class TestBPMEvaluationMixin(TestBPMMixin): rule = self.rule_tool.newContent(portal_type='Invoicing Rule', reference='default_invoicing_rule', trade_phase = 'default/invoicing', - expandable_property = ('aggregate_list', 'base_application_list', - 'base_contribution_list', 'causality_list', 'delivery_mode_list', - 'description', 'destination_account_list', - 'destination_function_list', 'destination_list', - 'destination_section_list', 'efficiency', 'incoterm_list', 'price', - 'price_currency_list', 'quantity', 'quantity_unit_list', - 'resource_list', 'source_account_list', 'source_function_list', - 'source_list', 'source_section_list', 'start_date', 'stop_date', - 'variation_category_list', 'variation_property_dict'), - matching_property = ('resource_list', 'variation_category_list', - 'variation_property_dict'), test_method_id = ('SimulationMovement_testInvoicingRule',) ) - rule.newContent(portal_type='Category Divergence Tester', - tested_property = ('resource_list | Resource', - 'source_section_list | Source Section', - 'destination_section_list | Destination Section', - 'source_list | Source', 'destination_list | Destination', - 'source_function_list | Source Function', - 'destination_function_list | Destination Function', - 'source_project_list | Source Project', - 'destination_project_list | Destination Project', - 'aggregate_list | Aggregate', - 'price_currency_list | Price Currency', - 'base_contribution_list | Base Contribution', - 'base_application_list | Base Application', - 'source_account_list | Source Account', - 'destination_account_list | Destination Account')) - rule.newContent(portal_type='Property Divergence Tester', - tested_property = ('start_date | Start Date', - 'stop_date | Stop Date')) - rule.newContent(portal_type='Quantity Divergence Tester') + # 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() diff --git a/product/ERP5/tests/testERP5SimulationBPMEvaluation.py b/product/ERP5/tests/testERP5SimulationBPMEvaluation.py deleted file mode 100644 index 8374c94fdf..0000000000 --- a/product/ERP5/tests/testERP5SimulationBPMEvaluation.py +++ /dev/null @@ -1,256 +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. -# -############################################################################## -""" -This is BPM Evaluation Test class using erp5_bpm development Business Template - -Generally it tries to use two Business Processes - one with sequence very -similar to normal ERP5 - TestBPMEvaluationDefaultProcessMixin, second one -inverted - TestBPMEvaluationDifferentProcessMixin. - -It uses only Sale path to demonstrate BPM. - -It is advised to *NOT* remove erp5_administration. -""" -import transaction - -from Products.ERP5.tests.testBPMCore import TestBPMMixin -from Products.ERP5.tests.testBPMEvaluation import \ - TestBPMEvaluationMixin, \ - test_suite - -if True: - def getBusinessTemplateList(self): - return TestBPMMixin.getBusinessTemplateList(self) + ('erp5_bpm', - 'erp5_administration', 'erp5_simulation',) - - TestBPMEvaluationMixin.getBusinessTemplateList = getBusinessTemplateList - - def _createRootTradeRule(self, **kw): - edit_dict = {} - edit_dict.update( - trade_phase = 'default/delivery', - ) - edit_dict.update(**kw) - rule = self.rule_tool.newContent(**edit_dict) - - # matching providers - for category in ('resource', 'order'): - 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 ('source_section', - 'resource', - 'destination_section', - 'source', - 'aggregate'): - 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) - - return rule - - 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( - ) - rule = self.rule_tool.newContent(portal_type='Invoicing Rule', - reference='default_invoicing_rule', - trade_phase = 'default/invoicing', - test_method_id = ('SimulationMovement_testInvoicingRule',) - ) - # 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._createInvoicingRule = _createInvoicingRule -- 2.30.9