Commit f25a7e70 authored by Lucas Carvalho's avatar Lucas Carvalho

Improved the code style, renamed scripts, updated TODO list.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@28397 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 6a4483ab
...@@ -68,7 +68,6 @@ class TestCommerce(ERP5TypeTestCase): ...@@ -68,7 +68,6 @@ class TestCommerce(ERP5TypeTestCase):
> implement Person_getApplicableDiscountList (actually just return None) > implement Person_getApplicableDiscountList (actually just return None)
> implement Person_getApplicableTaxList (actually always return a tax of 20%) > implement Person_getApplicableTaxList (actually always return a tax of 20%)
> Fix proxy for SaleOrder_confirmShopping, and anonym user cant call it ! > Fix proxy for SaleOrder_confirmShopping, and anonym user cant call it !
> SaleOrder_deleteShoppingCartItem doesnt use translation
> SaleOrder_externalPaymentHandler is totally empty > SaleOrder_externalPaymentHandler is totally empty
> SaleOrder_finalizeShopping doesnt check if the payment is successful or not > SaleOrder_finalizeShopping doesnt check if the payment is successful or not
> Fix proxy for SaleOrder_finalizeShopping anonym and normal user cant use it > Fix proxy for SaleOrder_finalizeShopping anonym and normal user cant use it
...@@ -86,6 +85,7 @@ class TestCommerce(ERP5TypeTestCase): ...@@ -86,6 +85,7 @@ class TestCommerce(ERP5TypeTestCase):
SaleOrder_getSelectedShippingResource SaleOrder_getSelectedShippingResource
SaleOrder_isShippingRequired SaleOrder_isShippingRequired
SaleOrder_paymentRedirect SaleOrder_paymentRedirect
SaleOrder_getShoppingCartDefaultCurrencySymbol
WebSection_checkPaypalIdentification WebSection_checkPaypalIdentification
WebSection_checkoutProcedure WebSection_checkoutProcedure
WebSection_doPaypalPayment WebSection_doPaypalPayment
...@@ -98,7 +98,7 @@ class TestCommerce(ERP5TypeTestCase): ...@@ -98,7 +98,7 @@ class TestCommerce(ERP5TypeTestCase):
WebSite_getPaypalUrl WebSite_getPaypalUrl
WebSite_setupECommerceWebSite WebSite_setupECommerceWebSite
Product_getRelatedDescription Product_getRelatedDescription
Person_editPersonalInformation (maybe useless to unittest) Person_editPersonalInformation
Resource_getShopUrl Resource_getShopUrl
""" """
...@@ -429,7 +429,7 @@ class TestCommerce(ERP5TypeTestCase): ...@@ -429,7 +429,7 @@ class TestCommerce(ERP5TypeTestCase):
portal = self.getPortal() portal = self.getPortal()
request = self.app.REQUEST request = self.app.REQUEST
default_product = self.getDefaultProduct() default_product = self.getDefaultProduct()
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, 1) portal.Resource_addToShoppingCart(default_product, 1)
portal.Resource_addToShoppingCart(default_product, 1) portal.Resource_addToShoppingCart(default_product, 1)
...@@ -440,21 +440,24 @@ class TestCommerce(ERP5TypeTestCase): ...@@ -440,21 +440,24 @@ class TestCommerce(ERP5TypeTestCase):
float(shopping_cart.SaleOrder_getShoppingCartTotalPrice())) float(shopping_cart.SaleOrder_getShoppingCartTotalPrice()))
# include taxes (by default it's 20%) # include taxes (by default it's 20%)
self.assertEquals(40.0*1.20, \ self.assertEquals(40.0*1.20, \
float(shopping_cart.SaleOrder_getShoppingCartTotalPrice(include_shipping = True, float(shopping_cart.SaleOrder_getShoppingCartTotalPrice(include_shipping=True,
include_taxes = True))) include_taxes=True)))
# no shipping selected yet so price should be the same # no shipping selected yet so price should be the same
self.assertEquals(40.0, \ self.assertEquals(40.0, \
float(shopping_cart.SaleOrder_getShoppingCartTotalPrice(include_shipping = True))) float(shopping_cart.SaleOrder_getShoppingCartTotalPrice(include_shipping=True)))
# add shipping # add shipping
shipping = self.getDefaultProduct('3') shipping = self.getDefaultProduct('3')
portal.SaleOrder_editShoppingCart(field_my_shipping_method=shipping.getRelativeUrl()) portal.SaleOrder_editShoppingCart(field_my_shipping_method=shipping.getRelativeUrl())
# test price calculation only with shipping # test price calculation only with shipping
self.assertEquals(40.0 + 10.0, \ self.assertEquals(40.0 + 10.0, \
float(shopping_cart.SaleOrder_getShoppingCartTotalPrice(include_shipping = True))) float(shopping_cart.SaleOrder_getShoppingCartTotalPrice(include_shipping=True)))
# test price calculation shipping and taxes # test price calculation shipping and taxes
self.assertEquals((40.0 + 10.0)*1.20, \ self.assertEquals((40.0 + 10.0)*1.20, \
float(shopping_cart.SaleOrder_getShoppingCartTotalPrice(include_shipping = True, float(shopping_cart.SaleOrder_getShoppingCartTotalPrice(include_shipping=True,
include_taxes = True))) include_taxes=True)))
def test_05_TestUpdateShoppingCart(self, quiet=0, run=run_all_test): def test_05_TestUpdateShoppingCart(self, quiet=0, run=run_all_test):
""" """
...@@ -470,30 +473,31 @@ class TestCommerce(ERP5TypeTestCase): ...@@ -470,30 +473,31 @@ class TestCommerce(ERP5TypeTestCase):
request = self.app.REQUEST request = self.app.REQUEST
default_product = self.getDefaultProduct() default_product = self.getDefaultProduct()
another_product = self.getDefaultProduct(id = '2') another_product = self.getDefaultProduct(id='2')
shipping = self.getDefaultProduct('3') shipping = self.getDefaultProduct('3')
request.set('session_id', SESSION_ID) request.set('session_id', SESSION_ID)
portal.Resource_addToShoppingCart(default_product, quantity=1) portal.Resource_addToShoppingCart(default_product, quantity=1)
portal.Resource_addToShoppingCart(another_product, quantity=1) portal.Resource_addToShoppingCart(another_product, quantity=1)
shopping_cart = portal.SaleOrder_getShoppingCart() shopping_cart = portal.SaleOrder_getShoppingCart()
portal.SaleOrder_editShoppingCart(field_my_shipping_method=shipping.getRelativeUrl()) shipping_url = shipping.getRelativeUrl()
portal.SaleOrder_editShoppingCart(field_my_shipping_method=shipping_url)
# increase shopping item number # increase shopping item number
portal.SaleOrder_editShoppingCart((2, 1,)) portal.SaleOrder_editShoppingCart((2, 1,))
# test price calculation without shipping and without taxes # test price calculation without shipping and without taxes
self.assertEquals((10.0*2 + 20.0*1)*1.0, \ self.assertEquals((10.0*2 + 20.0*1)*1.0, \
float(shopping_cart.SaleOrder_getShoppingCartTotalPrice(include_shipping = False, float(shopping_cart.SaleOrder_getShoppingCartTotalPrice(include_shipping=False,
include_taxes = False))) include_taxes=False)))
# test price calculation with shipping and without taxes # test price calculation with shipping and without taxes
self.assertEquals((10.0*2 + 20.0*1 + 10.0)*1.0, \ self.assertEquals((10.0*2 + 20.0*1 + 10.0)*1.0, \
float(shopping_cart.SaleOrder_getShoppingCartTotalPrice(include_shipping = True, float(shopping_cart.SaleOrder_getShoppingCartTotalPrice(include_shipping=True,
include_taxes = False))) include_taxes=False)))
# test price calculation with shipping and with taxes # test price calculation with shipping and with taxes
self.assertEquals((10.0*2 + 20.0*1 + 10.0)*1.20, \ self.assertEquals((10.0*2 + 20.0*1 + 10.0)*1.20, \
float(shopping_cart.SaleOrder_getShoppingCartTotalPrice(include_shipping = True, float(shopping_cart.SaleOrder_getShoppingCartTotalPrice(include_shipping=True,
include_taxes = True))) include_taxes=True)))
# delete shopping item # delete shopping item
portal.SaleOrder_deleteShoppingCartItem('1') portal.SaleOrder_deleteShoppingCartItem('1')
...@@ -820,7 +824,7 @@ class TestCommerce(ERP5TypeTestCase): ...@@ -820,7 +824,7 @@ class TestCommerce(ERP5TypeTestCase):
# create new python script to replace the external method # create new python script to replace the external method
custom_skin = self.getPortal().portal_skins.custom custom_skin = self.getPortal().portal_skins.custom
method_id = 'ERP5Base_submitPaypalNVPRequest' method_id = 'WebSection_submitPaypalNVPRequest'
if method_id in custom_skin.objectIds(): if method_id in custom_skin.objectIds():
custom_skin.manage_delObjects([method_id]) custom_skin.manage_delObjects([method_id])
custom_skin.manage_addProduct['PythonScripts']\ custom_skin.manage_addProduct['PythonScripts']\
...@@ -859,7 +863,7 @@ class TestCommerce(ERP5TypeTestCase): ...@@ -859,7 +863,7 @@ class TestCommerce(ERP5TypeTestCase):
portal.SaleOrder_getSelectedShippingResource()) portal.SaleOrder_getSelectedShippingResource())
#5 : paypal step 1 : get a new token #5 : paypal step 1 : get a new token
token = web_site.WebSite_getNewPaypalToken() token = web_site.checkout.WebSection_getNewPaypalToken()
self.assertNotEquals(token, None) self.assertNotEquals(token, None)
#6 : paypal step 2 : go to paypal and confirm this token #6 : paypal step 2 : go to paypal and confirm this token
......
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