Commit 0050fb85 authored by Lucas Carvalho's avatar Lucas Carvalho

Removed useless import. Updated TODO list. Replaced the test of...

Removed useless import. Updated TODO list. Replaced the test of SalerOrder_confirmShopping for SaleOrder_paymentRedirect.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@29040 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 9a1e7d75
...@@ -26,12 +26,9 @@ ...@@ -26,12 +26,9 @@
# #
############################################################################## ##############################################################################
import os, sys
from Testing import ZopeTestCase from Testing import ZopeTestCase
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from AccessControl.SecurityManagement import newSecurityManager from AccessControl.SecurityManagement import newSecurityManager
from AccessControl.SecurityManagement import getSecurityManager
from zLOG import LOG from zLOG import LOG
import transaction import transaction
import urllib import urllib
...@@ -67,7 +64,6 @@ class TestCommerce(ERP5TypeTestCase): ...@@ -67,7 +64,6 @@ class TestCommerce(ERP5TypeTestCase):
> Test SaleOrder_getShoppingCartItemList With include_shipping=True > Test SaleOrder_getShoppingCartItemList With include_shipping=True
> 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 !
> 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
...@@ -84,7 +80,6 @@ class TestCommerce(ERP5TypeTestCase): ...@@ -84,7 +80,6 @@ class TestCommerce(ERP5TypeTestCase):
SaleOrder_externalPaymentHandler SaleOrder_externalPaymentHandler
SaleOrder_getSelectedShippingResource SaleOrder_getSelectedShippingResource
SaleOrder_isShippingRequired SaleOrder_isShippingRequired
SaleOrder_paymentRedirect
WebSection_checkPaypalIdentification WebSection_checkPaypalIdentification
WebSection_checkoutProcedure WebSection_checkoutProcedure
WebSection_doPaypalPayment WebSection_doPaypalPayment
...@@ -195,11 +190,6 @@ class TestCommerce(ERP5TypeTestCase): ...@@ -195,11 +190,6 @@ class TestCommerce(ERP5TypeTestCase):
#XXX: Security hack (lucas) #XXX: Security hack (lucas)
self.portal.acl_users.zodb_roles.assignRoleToPrincipal('Manager', reference) self.portal.acl_users.zodb_roles.assignRoleToPrincipal('Manager', reference)
def changeUser(self, name):
user_folder = self.getPortal().acl_users
user = user_folder.getUserById(name).__of__(user_folder)
newSecurityManager(None, user)
def login(self): def login(self):
uf = self.getPortal().acl_users uf = self.getPortal().acl_users
uf._doAddUser('ivan', '', ['Manager'], []) uf._doAddUser('ivan', '', ['Manager'], [])
...@@ -587,14 +577,14 @@ class TestCommerce(ERP5TypeTestCase): ...@@ -587,14 +577,14 @@ class TestCommerce(ERP5TypeTestCase):
# XXX : actually the script is only in squeleton mode, only return a tax of 20% # XXX : actually the script is only in squeleton mode, only return a tax of 20%
self.assertEquals({'VAT':20.0}, self.getPortal().Person_getApplicableTaxList()) self.assertEquals({'VAT':20.0}, self.getPortal().Person_getApplicableTaxList())
def test_10_confirmShopping(self, quiet=0, run=run_all_test): def test_10_paymentRedirect(self, quiet=0, run=run_all_test):
""" """
Test the SaleOrder_confirmShopping script Test the SaleOrder_paymentRedirect script
""" """
if not run: if not run:
return return
if not quiet: if not quiet:
message = '\nTest the confirmation of shopping' message = '\nTest the confirmation of shopping and payment redirect'
ZopeTestCase._print(message) ZopeTestCase._print(message)
LOG('Testing... ', 0, message) LOG('Testing... ', 0, message)
portal = self.getPortal() portal = self.getPortal()
...@@ -609,14 +599,14 @@ class TestCommerce(ERP5TypeTestCase): ...@@ -609,14 +599,14 @@ class TestCommerce(ERP5TypeTestCase):
# the confirmation should not be possible if the user is not logged # the confirmation should not be possible if the user is not logged
self.logout() self.logout()
self.assertEquals(1, len(portal.SaleOrder_getShoppingCartItemList())) self.assertEquals(1, len(portal.SaleOrder_getShoppingCartItemList()))
self.portal.SaleOrder_confirmShopping() self.portal.SaleOrder_paymentRedirect()
self.assertTrue(urllib.quote("You need to create an account to " \ self.assertTrue(urllib.quote("You need to create an account to " \
"continue If you already have please login.") in "continue. If you already have please login.") in
request.RESPONSE.getHeader('location')) request.RESPONSE.getHeader('location'))
# but it should work if the user is authenticated # but it should work if the user is authenticated
self.changeUser('customer') self.changeUser('customer')
self.portal.SaleOrder_confirmShopping() self.portal.SaleOrder_paymentRedirect()
self.assertTrue(urllib.quote("SaleOrder_viewConfirmAsWeb") in self.assertTrue(urllib.quote("SaleOrder_viewConfirmAsWeb") in
request.RESPONSE.getHeader('location')) request.RESPONSE.getHeader('location'))
......
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