Skip to content

Commit 031ffa2

Browse files
committed
[FIX] intrastat_base: Fix tests
1 parent 7048932 commit 031ffa2

3 files changed

Lines changed: 13 additions & 10 deletions

File tree

intrastat_base/tests/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
from . import common
21
from . import test_all

intrastat_base/tests/common.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,31 @@
11
# Copyright 2021 ACSONE SA/NV
22
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
33

4+
from odoo.tests import new_test_user
45

5-
class IntrastatCommon:
6+
from odoo.addons.base.tests.common import BaseCommon
7+
8+
9+
class IntrastatCommon(BaseCommon):
610
@classmethod
711
def setUpClass(cls):
812
super().setUpClass()
9-
cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True))
1013
cls.chart_template_obj = cls.env["account.chart.template"]
1114
cls.mail_obj = cls.env["mail.mail"]
1215

13-
cls.demo_user = cls.env.ref("base.user_demo")
14-
cls.demo_company = cls.env.ref("base.main_company")
16+
cls.demo_user = new_test_user(
17+
cls.env,
18+
login="test-user",
19+
email="test@test.com",
20+
)
21+
cls.demo_company = cls.company
1522

1623
cls.shipping_cost = cls.env["product.product"].create(
1724
{
1825
"name": "Shipping costs TEST",
1926
"default_code": "TEST_SHIP",
2027
"type": "service",
2128
"is_accessory_cost": True,
22-
"categ_id": cls.env.ref("product.product_category_services"),
29+
"categ_id": cls.env.ref("product.product_category_services").id,
2330
}
2431
)

intrastat_base/tests/test_all.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,6 @@ def test_get_data(self, template_code):
4747
class TestIntrastatBase(IntrastatCommon):
4848
"""Tests for this module"""
4949

50-
@classmethod
51-
def setUpClass(cls):
52-
super().setUpClass()
53-
5450
def test_company(self):
5551
# add 'Demo user' to intrastat_remind_user_ids
5652
self.demo_company.write(
@@ -69,6 +65,7 @@ def test_no_email(self):
6965
def test_accessory(self):
7066
with self.assertRaises(ValidationError):
7167
self.shipping_cost.type = "consu"
68+
self.shipping_cost.is_accessory_cost = True
7269

7370
def test_fiscal_position(self):
7471
with self.assertRaises(ValidationError):

0 commit comments

Comments
 (0)