Commit 159b352c authored by Ivan Tyagov's avatar Ivan Tyagov

Fix test by properly initializing portal_caches.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@19782 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 53807ae7
...@@ -78,7 +78,6 @@ class TestCommerce(ERP5TypeTestCase): ...@@ -78,7 +78,6 @@ class TestCommerce(ERP5TypeTestCase):
user = uf.getUserById('ivan').__of__(uf) user = uf.getUserById('ivan').__of__(uf)
newSecurityManager(None, user) newSecurityManager(None, user)
def getBusinessTemplateList(self): def getBusinessTemplateList(self):
""" """
Return the list of required business templates. Return the list of required business templates.
...@@ -106,6 +105,11 @@ class TestCommerce(ERP5TypeTestCase): ...@@ -106,6 +105,11 @@ class TestCommerce(ERP5TypeTestCase):
request = self.app.REQUEST request = self.app.REQUEST
default_product = self.getDefaultProduct() default_product = self.getDefaultProduct()
# XXX: update cache manually only once in first test
# in normal Zope it will be updated at startup
# This is needed as Commerce uses its own Cache Factory
portal.portal_caches.updateCache()
# set 'session_id' to simulate browser (cookie) environment # set 'session_id' to simulate browser (cookie) environment
request.set('session_id', SESSION_ID) request.set('session_id', SESSION_ID)
...@@ -135,7 +139,6 @@ class TestCommerce(ERP5TypeTestCase): ...@@ -135,7 +139,6 @@ class TestCommerce(ERP5TypeTestCase):
# add in two speps same product and check that we do not create # add in two speps same product and check that we do not create
# new Sale Order Line but just increase quantity on existing one # new Sale Order Line but just increase quantity on existing one
portal.Resource_addToShoppingCart(default_product, 1) portal.Resource_addToShoppingCart(default_product, 1)
portal.Resource_addToShoppingCart(default_product, 1)
shoppping_cart_items = portal.SaleOrder_getShoppingCartItemList() shoppping_cart_items = portal.SaleOrder_getShoppingCartItemList()
self.assertEquals(1, len(shoppping_cart_items)) self.assertEquals(1, len(shoppping_cart_items))
self.assertEquals(2, shoppping_cart_items[0].getQuantity()) self.assertEquals(2, shoppping_cart_items[0].getQuantity())
...@@ -159,7 +162,6 @@ class TestCommerce(ERP5TypeTestCase): ...@@ -159,7 +162,6 @@ class TestCommerce(ERP5TypeTestCase):
request.set('session_id', SESSION_ID) request.set('session_id', SESSION_ID)
# add second diff product and check that we create new Sale Order Line # add second diff product and check that we create new Sale Order Line
portal.Resource_addToShoppingCart(default_product, 2)
portal.Resource_addToShoppingCart(another_product, 1) portal.Resource_addToShoppingCart(another_product, 1)
shoppping_cart_items = portal.SaleOrder_getShoppingCartItemList() shoppping_cart_items = portal.SaleOrder_getShoppingCartItemList()
self.assertEquals(2, len(shoppping_cart_items)) self.assertEquals(2, len(shoppping_cart_items))
...@@ -187,8 +189,6 @@ class TestCommerce(ERP5TypeTestCase): ...@@ -187,8 +189,6 @@ class TestCommerce(ERP5TypeTestCase):
another_product = self.getDefaultProduct(id = '2') another_product = self.getDefaultProduct(id = '2')
request.set('session_id', SESSION_ID) request.set('session_id', SESSION_ID)
portal.Resource_addToShoppingCart(default_product, 2)
portal.Resource_addToShoppingCart(another_product, 1)
shopping_cart = portal.SaleOrder_getShoppingCart() shopping_cart = portal.SaleOrder_getShoppingCart()
self.assertEquals(40.0, \ self.assertEquals(40.0, \
float(shopping_cart.SaleOrder_getShoppingCartTotalPrice())) float(shopping_cart.SaleOrder_getShoppingCartTotalPrice()))
......
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