summaryrefslogtreecommitdiff
path: root/addons/payment_authorize/tests
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2017-11-30 18:43:08 +0100
committerChristophe Simonis <chs@odoo.com>2017-11-30 18:43:08 +0100
commit42264d8dcb7f8d0795c84718d1fc9a5fd1aefd32 (patch)
tree216ded7eac5ba06623892aaaece74c586afd4b5e /addons/payment_authorize/tests
parente4a281b5a5f7ea44e4f25259b1a84cb0dc437ebc (diff)
parent5d7ad2b16cc3ef579a6657822b7c57b07fef4f52 (diff)
[MERGE] forward port branch saas-16 up to 5d7ad2b16cc
Diffstat (limited to 'addons/payment_authorize/tests')
-rw-r--r--addons/payment_authorize/tests/test_authorize.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/addons/payment_authorize/tests/test_authorize.py b/addons/payment_authorize/tests/test_authorize.py
index 98d87b04116..9e438deb76c 100644
--- a/addons/payment_authorize/tests/test_authorize.py
+++ b/addons/payment_authorize/tests/test_authorize.py
@@ -212,7 +212,7 @@ class AuthorizeForm(AuthorizeCommon):
'acquirer_id': authorize.id,
'type': 'server2server',
'currency_id': self.currency_usd.id,
- 'reference': 'test_ref_%s' % odoo.fields.Date.today(),
+ 'reference': 'test_ref_%s' % int(time.time()),
'payment_token_id': payment_token.id,
'partner_id': self.buyer_id,
@@ -254,3 +254,20 @@ class AuthorizeForm(AuthorizeCommon):
self.assertEqual(transaction.state, 'authorized')
transaction.action_void()
self.assertEqual(transaction.state, 'cancel')
+
+ # try charging an unexisting profile
+ ghost_payment_token = payment_token.copy()
+ ghost_payment_token.authorize_profile = '99999999999'
+ # create normal s2s transaction
+ transaction = self.env['payment.transaction'].create({
+ 'amount': 500,
+ 'acquirer_id': authorize.id,
+ 'type': 'server2server',
+ 'currency_id': self.currency_usd.id,
+ 'reference': 'test_ref_%s' % int(time.time()),
+ 'payment_token_id': ghost_payment_token.id,
+ 'partner_id': self.buyer_id,
+
+ })
+ transaction.authorize_s2s_do_transaction()
+ self.assertEqual(transaction.state, 'error')