Commit 8f2334e8 authored by Jérome Perrin's avatar Jérome Perrin Committed by Aurel

payment_mean: test that we can not "Select Payments" more than once at a time

parent 35db1deb
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
# #
############################################################################## ##############################################################################
import urlparse
from DateTime import DateTime from DateTime import DateTime
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
...@@ -333,3 +334,26 @@ class TestPaymentTransactionGroupPaymentSelection(AccountingTestCase): ...@@ -333,3 +334,26 @@ class TestPaymentTransactionGroupPaymentSelection(AccountingTestCase):
payment.bank.getAggregateValueList(), payment.bank.getAggregateValueList(),
[ptg]) [ptg])
self.assertTrue(payment.getReference()) self.assertTrue(payment.getReference())
def test_select_payment_transaction_refused_when_activities_are_running(self):
ptg1 = self.portal.payment_transaction_group_module.newContent(
portal_type='Payment Transaction Group',)
ptg2 = self.portal.payment_transaction_group_module.newContent(
portal_type='Payment Transaction Group',)
self.tic()
ret = ptg1.PaymentTransactionGroup_selectPaymentTransactionLineList(select_mode='stopped_or_delivered')
self.assertEqual(
urlparse.parse_qs(urlparse.urlparse(ret).query)['portal_status_message'],
['Payment selection in progress.'])
self.commit()
ret = ptg1.PaymentTransactionGroup_selectPaymentTransactionLineList(select_mode='stopped_or_delivered')
self.assertEqual(
urlparse.parse_qs(urlparse.urlparse(ret).query)['portal_status_message'],
['Some payments are still beeing processed in the background, please retry later'])
self.commit()
# another PTG is same, because we also want to prevent things like two users selecting
# payments at the same time.
ret = ptg2.PaymentTransactionGroup_selectPaymentTransactionLineList(select_mode='stopped_or_delivered')
self.assertEqual(
urlparse.parse_qs(urlparse.urlparse(ret).query)['portal_status_message'],
['Some payments are still beeing processed in the background, please retry later'])
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