mirror of
https://github.com/OCA/bank-payment.git
synced 2025-02-02 10:37:31 +02:00
[IMP] account_banking_sepa_direct_debit: test performance improvement
- 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:
committed by
Sébastien Alix
parent
1e4d4a7f1c
commit
d154ccabd7
@@ -48,11 +48,22 @@ class TestMandate(TransactionCase):
|
||||
self.assertEqual(self.mandate.state, "draft")
|
||||
self.assertTrue(self.mandate.is_sent)
|
||||
|
||||
def setUp(self):
|
||||
res = super().setUp()
|
||||
self.partner = self.env.ref("base.res_partner_12")
|
||||
bank_account = self.env.ref("account_payment_mode.res_partner_12_iban")
|
||||
self.mandate = self.env["account.banking.mandate"].create(
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
res = super().setUpClass()
|
||||
cls.env = cls.env(
|
||||
context=dict(
|
||||
cls.env.context,
|
||||
mail_create_nolog=True,
|
||||
mail_create_nosubscribe=True,
|
||||
mail_notrack=True,
|
||||
no_reset_password=True,
|
||||
tracking_disable=True,
|
||||
)
|
||||
)
|
||||
cls.partner = cls.env.ref("base.res_partner_12")
|
||||
bank_account = cls.env.ref("account_payment_mode.res_partner_12_iban")
|
||||
cls.mandate = cls.env["account.banking.mandate"].create(
|
||||
{
|
||||
"partner_bank_id": bank_account.id,
|
||||
"format": "sepa",
|
||||
|
||||
@@ -10,11 +10,14 @@ from odoo import fields
|
||||
from odoo.tests.common import TransactionCase
|
||||
from odoo.tools import float_compare
|
||||
|
||||
from odoo.addons.base.tests.common import DISABLED_MAIL_CONTEXT
|
||||
|
||||
|
||||
class TestSDDBase(TransactionCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super().setUpClass()
|
||||
cls.env = cls.env(context=dict(cls.env.context, **DISABLED_MAIL_CONTEXT))
|
||||
cls.company_B = cls.env["res.company"].create({"name": "Company B"})
|
||||
cls.account_payable_company_B = cls.env["account.account"].create(
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user