From 5e93a231c2ca971ac758bde4ecc90ac1ec118f7b Mon Sep 17 00:00:00 2001 From: Victor Feyens Date: Tue, 10 May 2022 10:49:33 +0000 Subject: [PATCH] [FIX] payment_stripe: running tests with python 3.7 mock.call_args only provides the args/kwargs feature in 3.8+ closes odoo/odoo#90716 Related: odoo/enterprise#27253 Signed-off-by: Antoine Vandevenne (anv) --- addons/payment_stripe/tests/test_stripe.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/addons/payment_stripe/tests/test_stripe.py b/addons/payment_stripe/tests/test_stripe.py index 1d38e29b11a..91790306f7e 100644 --- a/addons/payment_stripe/tests/test_stripe.py +++ b/addons/payment_stripe/tests/test_stripe.py @@ -1,5 +1,6 @@ # Part of Odoo. See LICENSE file for full copyright and licensing details. +import sys from unittest.mock import patch from odoo.tests import tagged @@ -153,5 +154,9 @@ class StripeTest(StripeCommon, PaymentHttpCommon): return_value={'url': 'https://dummy.url'}, ) as mock: self.stripe._stripe_create_account_link('dummy', 'dummy') - for payload_param in ('account', 'return_url', 'refresh_url', 'type'): - self.assertIn(payload_param, mock.call_args.kwargs['payload'].keys()) + mock.assert_called_once() + if sys.version_info >= (3, 8): + # call_args.kwargs is only available in python 3.8+ + call_args = mock.call_args.kwargs['payload'].keys() + for payload_param in ('account', 'return_url', 'refresh_url', 'type'): + self.assertIn(payload_param, call_args)