[FIX] payment: Make tests demo data independent

Part-of: odoo/odoo#146649
This commit is contained in:
Yannick Tivisse
2023-12-18 23:32:05 +00:00
parent be58bb0586
commit b1f392ce58
5 changed files with 14 additions and 12 deletions
+4 -3
View File
@@ -3,13 +3,14 @@
from odoo import Command
from odoo.addons.payment.tests.common import PaymentCommon
from odoo.addons.account.tests.common import AccountTestInvoicingCommon
class AsiaPayCommon(PaymentCommon):
class AsiaPayCommon(AccountTestInvoicingCommon, PaymentCommon):
@classmethod
def setUpClass(cls):
super().setUpClass()
def setUpClass(cls, chart_template_ref=None):
super().setUpClass(chart_template_ref=chart_template_ref)
cls.asiapay = cls._prepare_provider('asiapay', update_values={
'asiapay_merchant_id': '123456789',
@@ -13,7 +13,7 @@ class TestPaymentProvider(AsiaPayCommon):
""" Test that AsiaPay providers are filtered out from compatible providers when the currency
is not supported. """
compatible_providers = self.env['payment.provider']._get_compatible_providers(
self.company_id, self.partner.id, self.amount, currency_id=self.env.ref('base.AFN').id
self.env.company.id, self.partner.id, self.amount, currency_id=self.env.ref('base.AFN').id
)
self.assertNotIn(self.asiapay, compatible_providers)
+4 -4
View File
@@ -1,13 +1,13 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo.addons.payment.tests.common import PaymentCommon
from odoo.addons.account.tests.common import AccountTestInvoicingCommon
class OgoneCommon(PaymentCommon):
class OgoneCommon(AccountTestInvoicingCommon, PaymentCommon):
@classmethod
def setUpClass(cls):
super().setUpClass()
def setUpClass(cls, chart_template_ref=None):
super().setUpClass(chart_template_ref=chart_template_ref)
cls.ogone = cls._prepare_provider('ogone', update_values={
'ogone_pspid': 'dummy',
+4 -3
View File
@@ -1,13 +1,14 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo.addons.payment.tests.common import PaymentCommon
from odoo.addons.account.tests.common import AccountTestInvoicingCommon
class PayULatamCommon(PaymentCommon):
class PayULatamCommon(AccountTestInvoicingCommon, PaymentCommon):
@classmethod
def setUpClass(cls):
super().setUpClass()
def setUpClass(cls, chart_template_ref=None):
super().setUpClass(chart_template_ref=chart_template_ref)
cls.payulatam = cls._prepare_provider('payulatam', update_values={
'payulatam_account_id': 'dummy',
@@ -21,7 +21,7 @@ class PayULatamTest(PayULatamCommon, PaymentHttpCommon):
def test_incompatibility_with_unsupported_currency(self):
""" Test that the PayULatam provider is not compatible with an unsupported currency. """
compatible_providers = self.env['payment.provider']._get_compatible_providers(
self.company.id, self.partner.id, self.amount, currency_id=self.currency_euro.id
self.env.company.id, self.partner.id, self.amount, currency_id=self.currency_euro.id
)
self.assertNotIn(self.payulatam, compatible_providers)