Commit e44fefba authored by Jérome Perrin's avatar Jérome Perrin

test_11_getPriceWithDestinationSection was failing randomly, because it was

testing that a supply line where no destination section was defined only
applies to context where no destination section is defined. This is not the
case, supply lines with no destination section defined applies regardless of
the context's destination section.
( In Movement.getPrice, there is code to give priority to sales supply lines
defining destination section in the case of sales, and this is tested in
test_12_getInternalVsPurchaseVsSalePrice )


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@31711 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent b936b211
...@@ -707,15 +707,6 @@ class TestResource(ERP5TypeTestCase): ...@@ -707,15 +707,6 @@ class TestResource(ERP5TypeTestCase):
# Create product # Create product
product_module = self.portal.getDefaultModule(self.product_portal_type) product_module = self.portal.getDefaultModule(self.product_portal_type)
supply_module = self.portal.getDefaultModule(self.sale_supply_portal_type) supply_module = self.portal.getDefaultModule(self.sale_supply_portal_type)
# Create generic supply
self.logMessage("Creating generic fake supply ...", tab=1)
generic_supply = supply_module.newContent(
portal_type=self.sale_supply_portal_type,
title='FakeGenericSupply',)
# Create empty supply line
supply_line = generic_supply.newContent(
portal_type=self.sale_supply_line_portal_type)
supply_line.setProperty('base_price', 0)
for j in range(33, 35): for j in range(33, 35):
self.logMessage("Creating fake product %s..." % j, tab=1) self.logMessage("Creating fake product %s..." % j, tab=1)
product = product_module.newContent( product = product_module.newContent(
...@@ -743,13 +734,6 @@ class TestResource(ERP5TypeTestCase): ...@@ -743,13 +734,6 @@ class TestResource(ERP5TypeTestCase):
supply_line.setProperty('base_price', base_price) supply_line.setProperty('base_price', base_price)
# Register the case # Register the case
test_case_list.append((product, node, base_price)) test_case_list.append((product, node, base_price))
# Create generic supply line
self.logMessage("Creating generic fake supply line ...", tab=1)
supply_line = generic_supply.newContent(
portal_type=self.sale_supply_line_portal_type,
resource_value=product)
supply_line.setProperty('base_price', j)
test_case_list.append((product, None, j))
# Commit transaction # Commit transaction
self.logMessage("Commit transaction...", tab=1) self.logMessage("Commit transaction...", tab=1)
transaction.commit() transaction.commit()
...@@ -758,19 +742,12 @@ class TestResource(ERP5TypeTestCase): ...@@ -758,19 +742,12 @@ class TestResource(ERP5TypeTestCase):
self.tic() self.tic()
# Test the cases # Test the cases
for product, node, base_price in test_case_list: for product, node, base_price in test_case_list:
if node is not None: self.logMessage("Check product %s with destination section %s" % \
self.logMessage("Check product %s with destination section %s" % \ (product.getTitle(), node.getTitle()),
(product.getTitle(), node.getTitle()), tab=1)
tab=1) self.assertEquals(base_price,
self.assertEquals(base_price, product.getPrice(
product.getPrice( categories=['destination_section/%s' % node.getRelativeUrl()]))
categories=['destination_section/%s' % node.getRelativeUrl()]))
else:
self.logMessage("Check product %s without destination section" % \
product.getTitle(),
tab=1)
self.assertEquals(base_price,
product.getPrice())
def test_11b_getPriceWithCells(self, quiet=quiet, run=run_all_test): def test_11b_getPriceWithCells(self, quiet=quiet, run=run_all_test):
""" """
...@@ -887,6 +864,9 @@ class TestResource(ERP5TypeTestCase): ...@@ -887,6 +864,9 @@ class TestResource(ERP5TypeTestCase):
product.getPrice(categories=[variation])) product.getPrice(categories=[variation]))
# The following test tests Movement.getPrice, which is based on the movement
# context.
def test_12_getInternalVsPurchaseVsSalePrice(self, quiet=quiet, run=run_all_test): def test_12_getInternalVsPurchaseVsSalePrice(self, quiet=quiet, run=run_all_test):
""" """
Test the pricing model with internal, purchase and sale supply Test the pricing model with internal, purchase and sale supply
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment