diff --git a/product/ERP5/tests/testTradeCondition.py b/product/ERP5/tests/testTradeCondition.py index b34df15273f36f25559b3099704bd5eebaf0a5c4..6c8f80f862f8e62395be5ce32b58abf681add1ee 100644 --- a/product/ERP5/tests/testTradeCondition.py +++ b/product/ERP5/tests/testTradeCondition.py @@ -103,95 +103,6 @@ class TradeConditionTestCase(ERP5TypeTestCase, SubcontentReindexingWrapper): portal_type=self.trade_condition_type) supply_line = trade_condition.newContent(portal_type=self.supply_line_type) self._testSubContentReindexing(trade_condition, [supply_line]) - return - # If trade condition is modified, then supply lines must be reindexed - another_resource = self.portal.product_module.newContent(portal_type='Product', - title='Another Resource') - - # Supply lines are made without source_section and destination_section - supply_line_1 = self.trade_condition.newContent(portal_type=self.supply_line_type, - resource_value=self.resource) - supply_line_2 = self.trade_condition.newContent(portal_type=self.supply_line_type, - resource_value=another_resource) - - transaction.commit() - self.tic() - - # Set source_section and destination_section to trade condition - # Then recursive reindex should be called - self.trade_condition.edit(source_section_value=self.client, - destination_section_value=self.vendor) - - transaction.commit() - self.tic() - - # New indexes have source_section, destination_section - self.assertEqual(len(self.portal.portal_catalog(portal_type=self.trade_condition_type, - source_section_relative_url=self.client.getRelativeUrl(), - destination_section_relative_url=self.vendor.getRelativeUrl())), - 1) - - self.assertEqual(len(self.portal.portal_catalog(portal_type=self.supply_line_type, - resource_relative_url=another_resource.getRelativeUrl(), - source_section_relative_url=self.client.getRelativeUrl(), - destination_section_relative_url=self.vendor.getRelativeUrl())), - 1) - - self.assertEqual(len(self.portal.portal_catalog(portal_type=self.supply_line_type, - resource_relative_url=self.resource.getRelativeUrl(), - source_section_relative_url=self.client.getRelativeUrl(), - destination_section_relative_url=self.vendor.getRelativeUrl())), - 1) - - # Change source_section and destination_section - company_a = self.portal.organisation_module.newContent(portal_type='Organisation', - title='Company A') - company_b = self.portal.organisation_module.newContent(portal_type='Organisation', - title='Company B') - - transaction.commit() - self.tic() - - # When edit, recursive reindex should be called - self.trade_condition.edit(source_section_value=None, - destination_section_value=None, - source_value=company_a, - destination_value=company_b) - - transaction.commit() - self.tic() - - # No old indexes - self.assertEqual(len(self.portal.portal_catalog(portal_type=self.trade_condition_type, - source_section_relative_url=self.client.getRelativeUrl(), - destination_section_relative_url=self.vendor.getRelativeUrl())), - 0) - self.assertEqual(len(self.portal.portal_catalog(portal_type=self.supply_line_type, - resource_relative_url=self.resource.getRelativeUrl(), - source_section_relative_url=self.client.getRelativeUrl(), - destination_section_relative_url=self.vendor.getRelativeUrl())), - 0) - self.assertEqual(len(self.portal.portal_catalog(portal_type=self.supply_line_type, - resource_relative_url=another_resource.getRelativeUrl(), - source_section_relative_url=self.client.getRelativeUrl(), - destination_section_relative_url=self.vendor.getRelativeUrl())), - 0) - # New indexes - self.assertEqual(len(self.portal.portal_catalog(portal_type=self.trade_condition_type, - source_relative_url=company_a.getRelativeUrl(), - destination_relative_url=company_b.getRelativeUrl())), - 1) - self.assertEqual(len(self.portal.portal_catalog(portal_type=self.supply_line_type, - resource_relative_url=self.resource.getRelativeUrl(), - source_relative_url=company_a.getRelativeUrl(), - destination_relative_url=company_b.getRelativeUrl())), - 1) - self.assertEqual(len(self.portal.portal_catalog(portal_type=self.supply_line_type, - resource_relative_url=another_resource.getRelativeUrl(), - source_relative_url=company_a.getRelativeUrl(), - destination_relative_url=company_b.getRelativeUrl())), - 1) - class AccountingBuildTestCase(TradeConditionTestCase): """Same as TradeConditionTestCase, but with a rule to generate