Skip to content

Commit

Permalink
[REF] faster tests with SavePointCase
Browse files Browse the repository at this point in the history
  • Loading branch information
rvalyi committed Jun 26, 2023
1 parent 8ecbe95 commit 6b5d50a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
15 changes: 8 additions & 7 deletions l10n_br_base/tests/test_partner_bank.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo.exceptions import UserError
from odoo.tests import TransactionCase
from odoo.tests import SavepointCase


class PartnerBankTest(TransactionCase):
def setUp(self):
super().setUp()
self.partner_bank_model = self.env["res.partner.bank"]
self.partner_id = self.env.ref("l10n_br_base.res_partner_amd")
self.bank_id = self.env.ref("l10n_br_base.res_bank_001")
class PartnerBankTest(SavepointCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.partner_bank_model = cls.env["res.partner.bank"]
cls.partner_id = cls.env.ref("l10n_br_base.res_partner_amd")
cls.bank_id = cls.env.ref("l10n_br_base.res_bank_001")

def test_ok_transactional_acc_type(self):
ok_bank_vals = {
Expand Down
13 changes: 7 additions & 6 deletions l10n_br_base/tests/test_valid_pix.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,18 @@
from psycopg2 import IntegrityError

from odoo.exceptions import ValidationError
from odoo.tests import TransactionCase
from odoo.tests import SavepointCase
from odoo.tools import mute_logger


class ValidCreatePIXTest(TransactionCase):
class ValidCreatePIXTest(SavepointCase):
"""Test if ValidationError is raised well during create({})"""

def setUp(self):
super().setUp()
self.res_partner_pix_model = self.env["res.partner.pix"]
self.partner_id = self.env.ref("l10n_br_base.res_partner_amd")
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.res_partner_pix_model = cls.env["res.partner.pix"]
cls.partner_id = cls.env.ref("l10n_br_base.res_partner_amd")

def test_invalid_pix_cnpj_too_big(self):
pix_vals = {
Expand Down

0 comments on commit 6b5d50a

Please sign in to comment.