[IMP] account_payment_order: test performance improvement

- Create setUpClass method
- Switch to setUpClass (if needed) for avoiding repeat the same setup for each test.
- Include context keys for avoiding mail operations overhead.
This commit is contained in:
josep-tecnativa
2023-10-16 12:27:21 +02:00
committed by Sébastien Alix
parent fb443140a8
commit 7d9d5400fc
2 changed files with 7 additions and 1 deletions

View File

@@ -4,8 +4,15 @@
from odoo.exceptions import ValidationError
from odoo.tests.common import TransactionCase
from odoo.addons.base.tests.common import DISABLED_MAIL_CONTEXT
class TestBank(TransactionCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.env = cls.env(context=dict(cls.env.context, **DISABLED_MAIL_CONTEXT))
def test_bank(self):
bank = self.env["res.bank"].search([], limit=1)
self.assertTrue(bank)

View File

@@ -18,7 +18,6 @@ class TestPaymentMode(TransactionCase):
AccountPaymentMethod._get_payment_method_information
)
@classmethod
def _get_payment_method_information(cls):
res = Method_get_payment_method_information(cls)
res["IN"] = {"mode": "multi", "domain": [("type", "=", "bank")]}