Commit 37f7b8e6 authored by Yusei Tahara's avatar Yusei Tahara

Added a test with negative price order line.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@25141 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 1c9bdc1b
......@@ -42,6 +42,7 @@ class TestOrderMixin:
default_quantity = 99
default_price = 555
default_negative_price = -5550
resource_portal_type = 'Apparel Model'
order_portal_type = 'Sale Order'
order_line_portal_type = 'Sale Order Line'
......@@ -103,7 +104,7 @@ class TestOrderMixin:
portal_type='Category',
id=category_id)
product_line_category_list = ['apparel', ]
product_line_category_list = ['apparel', 'cancel']
if len(category_tool.product_line.contentValues()) == 0:
for category_id in product_line_category_list:
o = category_tool.product_line.newContent(
......@@ -132,6 +133,23 @@ class TestOrderMixin:
resource_list.append(resource)
sequence.edit( resource_list = resource_list )
def stepCreateNotVariatedResourceForNegativePriceOrderLine(self, sequence=None, sequence_list=None, **kw):
"""
Create a resource with no variation for negative price order line.
"""
portal = self.getPortal()
resource_module = portal.getDefaultModule(self.resource_portal_type)
resource = resource_module.newContent(portal_type=self.resource_portal_type)
resource.edit(
title = "NotVariatedResourceForNegativePriceOrderLine%s" % resource.getId(),
product_line = 'cancel'
)
sequence.edit( resource = resource )
resource_list = sequence.get('resource_list',default=[])
resource_list.append(resource)
sequence.edit( resource_list = resource_list )
def stepCreateVariatedResource(self, sequence=None, sequence_list=None, \
**kw):
"""
......@@ -435,6 +453,15 @@ class TestOrderMixin:
order_line.edit(quantity=self.default_quantity,
price=self.default_price)
def stepSetOrderLineDefaultNegativePriceValue(self, sequence=None, \
sequence_list=None, **kw):
"""
Set the default negative price and 1 to quantity on the order line.
"""
order_line = sequence.get('order_line')
order_line.edit(quantity=1,
price=self.default_negative_price)
def stepCheckOrderLineDefaultValues(self, sequence=None, \
sequence_list=None, **kw):
"""
......@@ -1390,6 +1417,33 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_09b_Order_testTotalPriceWithNegativePriceOrderLine(self, quiet=0, run=run_all_test):
"""
Test method getTotalPrice on a order
"""
if not run: return
sequence_list = SequenceList()
# Test with positive price order line and negative price order line.
sequence_string = '\
stepCreateOrder \
stepCheckOrderTotalQuantity \
stepCreateNotVariatedResource \
stepCreateOrderLine \
stepTic \
stepSetOrderLineResource \
stepSetOrderLineDefaultValues \
stepTic \
stepCreateNotVariatedResourceForNegativePriceOrderLine \
stepCreateOrderLine \
stepTic \
stepSetOrderLineResource \
stepSetOrderLineDefaultNegativePriceValue \
stepTic \
stepCheckOrderTotalPrice \
'
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_10_Order_testSimulationState(self, quiet=0, run=run_all_test):
"""
Test simulation state acquisition on Order
......
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