Add fake payment

Add specilized trade condition
Remove annotation
Update returned url when check paypal payment


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@41604 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 0b54fc44
...@@ -70,11 +70,8 @@ class TestCommerce(ERP5TypeTestCase): ...@@ -70,11 +70,8 @@ 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%)
> SaleOrder_externalPaymentHandler is totally empty > SaleOrder_externalPaymentHandler is totally empty
> 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
> SaleOrder_getAvailableShippingResourceList have hardcoded > SaleOrder_getAvailableShippingResourceList have hardcoded
> SaleOrder_isConsistent the usage must be more generic or rename it
> SaleOrder_isShippingRequired this script just return 1 ...
Not tested : Not tested :
Person_getApplicableDiscountList Person_getApplicableDiscountList
...@@ -120,6 +117,7 @@ class TestCommerce(ERP5TypeTestCase): ...@@ -120,6 +117,7 @@ class TestCommerce(ERP5TypeTestCase):
product_module = self.portal.product_module product_module = self.portal.product_module
currency_module = self.portal.currency_module currency_module = self.portal.currency_module
sale_order_module = self.portal.sale_order_module sale_order_module = self.portal.sale_order_module
condition_module = self.portal.sale_trade_condition_module
currency_module.manage_permission('Access contents information', currency_module.manage_permission('Access contents information',
roles=['Anonymous'], acquire=0) roles=['Anonymous'], acquire=0)
product_module.manage_permission('Access contents information', product_module.manage_permission('Access contents information',
...@@ -160,6 +158,12 @@ class TestCommerce(ERP5TypeTestCase): ...@@ -160,6 +158,12 @@ class TestCommerce(ERP5TypeTestCase):
shipping.validate() shipping.validate()
shipping.publish() shipping.publish()
# add default trade condition
condition = condition_module.newContent(id="default_trade_condition",
portal_type="Sale Trade Condition",
specialise="business_process_module/erp5_default_business_process")
condition.validate()
# validate default order rule # validate default order rule
rule = self.getRule(reference='default_order_rule') rule = self.getRule(reference='default_order_rule')
if rule.getValidationState() != 'validated': if rule.getValidationState() != 'validated':
...@@ -184,6 +188,7 @@ class TestCommerce(ERP5TypeTestCase): ...@@ -184,6 +188,7 @@ class TestCommerce(ERP5TypeTestCase):
self.clearModule(self.portal.product_module) self.clearModule(self.portal.product_module)
self.clearModule(self.portal.sale_order_module) self.clearModule(self.portal.sale_order_module)
self.clearModule(self.portal.currency_module) self.clearModule(self.portal.currency_module)
self.clearModule(self.portal.sale_trade_condition_module)
self.portal.portal_caches.clearAllCache() self.portal.portal_caches.clearAllCache()
def createDefaultOrganisation(self): def createDefaultOrganisation(self):
...@@ -352,6 +357,12 @@ class TestCommerce(ERP5TypeTestCase): ...@@ -352,6 +357,12 @@ class TestCommerce(ERP5TypeTestCase):
transaction.commit() transaction.commit()
self.tic() self.tic()
def doFakePayment(self):
"""Simulate a payment"""
#Set the shopping cart payed
self.website.SaleOrder_setShoppingCartBuyer()
def test_01_AddResourceToShoppingCart(self): def test_01_AddResourceToShoppingCart(self):
""" """
Test adding an arbitrary resources to shopping cart. Test adding an arbitrary resources to shopping cart.
...@@ -588,7 +599,6 @@ class TestCommerce(ERP5TypeTestCase): ...@@ -588,7 +599,6 @@ class TestCommerce(ERP5TypeTestCase):
# Check if the Shopping Cart is empty # Check if the Shopping Cart is empty
self.assertEquals(0, len(self.website.SaleOrder_getShoppingCartItemList())) self.assertEquals(0, len(self.website.SaleOrder_getShoppingCartItemList()))
@newSimulationExpectedFailure
def test_11_finalizeShopping(self): def test_11_finalizeShopping(self):
""" """
Test the SaleOrder_finalizeShopping script Test the SaleOrder_finalizeShopping script
...@@ -604,6 +614,9 @@ class TestCommerce(ERP5TypeTestCase): ...@@ -604,6 +614,9 @@ class TestCommerce(ERP5TypeTestCase):
self.assertEquals(2, len(self.website.SaleOrder_getShoppingCartItemList())) self.assertEquals(2, len(self.website.SaleOrder_getShoppingCartItemList()))
self.assertEquals(0, len(self.portal.sale_order_module.contentValues())) self.assertEquals(0, len(self.portal.sale_order_module.contentValues()))
#Simulate payment
self.doFakePayment()
self.website.SaleOrder_finalizeShopping() self.website.SaleOrder_finalizeShopping()
transaction.commit() transaction.commit()
self.tic() self.tic()
...@@ -682,7 +695,6 @@ class TestCommerce(ERP5TypeTestCase): ...@@ -682,7 +695,6 @@ class TestCommerce(ERP5TypeTestCase):
self.assertEquals(currency.getShortTitle(), self.assertEquals(currency.getShortTitle(),
self.website.WebSite_getShoppingCartDefaultCurrencySymbol()) self.website.WebSite_getShoppingCartDefaultCurrencySymbol())
@newSimulationExpectedFailure
def test_16_simulatePaypalPayment(self): def test_16_simulatePaypalPayment(self):
""" """
Test all the scripts related to paypal Test all the scripts related to paypal
...@@ -726,9 +738,8 @@ class TestCommerce(ERP5TypeTestCase): ...@@ -726,9 +738,8 @@ class TestCommerce(ERP5TypeTestCase):
#6 : paypal step 3 : check if this token is confirmed by paypal #6 : paypal step 3 : check if this token is confirmed by paypal
error = self.website.WebSection_checkPaypalIdentification() error = self.website.WebSection_checkPaypalIdentification()
self.assertEquals(error, None) self.assertEquals(error, None)
url_location = request.RESPONSE.getHeader('location') url_location = request.RESPONSE.getHeader('location')
self.assertTrue('/SaleOrder_viewAsWeb' in url_location) self.assertTrue('/checkout' in url_location)
#7 : paypal step 4 : validate the payment #7 : paypal step 4 : validate the payment
self.assertEquals(1, self.assertEquals(1,
...@@ -921,7 +932,6 @@ class TestCommerce(ERP5TypeTestCase): ...@@ -921,7 +932,6 @@ class TestCommerce(ERP5TypeTestCase):
self.assertEquals(product.Resource_getShopUrl(), self.assertEquals(product.Resource_getShopUrl(),
'%s/%s' % (product.absolute_url(), 'Resource_viewAsShop')) '%s/%s' % (product.absolute_url(), 'Resource_viewAsShop'))
@newSimulationExpectedFailure
def test_28_finalizeShoppingWithComment(self): def test_28_finalizeShoppingWithComment(self):
""" """
Testing if the comment added during the checkout will be set on the sale Testing if the comment added during the checkout will be set on the sale
...@@ -933,6 +943,7 @@ class TestCommerce(ERP5TypeTestCase): ...@@ -933,6 +943,7 @@ class TestCommerce(ERP5TypeTestCase):
quantity=1) quantity=1)
self.website.SaleOrder_paymentRedirect(field_my_comment=comment) self.website.SaleOrder_paymentRedirect(field_my_comment=comment)
self.doFakePayment()
self.website.SaleOrder_finalizeShopping() self.website.SaleOrder_finalizeShopping()
transaction.commit() transaction.commit()
self.tic() self.tic()
......
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