From ea17d1bbe7a94226ed77dbdcb67ba916e6c709ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sat, 5 Dec 2020 11:53:48 +0100 Subject: [PATCH] Add generic test for check erase party issue9895 review324571002 --- tests/__init__.py | 10 +++++++--- tests/test_company.py | 10 +++++++++- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/tests/__init__.py b/tests/__init__.py index 4d5fd317c3..12e1dd30a6 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -3,9 +3,13 @@ try: from trytond.modules.company.tests.test_company import ( - suite, create_company, set_company, create_employee) + suite, create_company, set_company, create_employee, + PartyCompanyCheckEraseMixin) except ImportError: from .test_company import ( - suite, create_company, set_company, create_employee) + suite, create_company, set_company, create_employee, + PartyCompanyCheckEraseMixin) -__all__ = ['suite', 'create_company', 'set_company', 'create_employee'] +__all__ = [ + 'suite', 'create_company', 'set_company', 'create_employee', + 'PartyCompanyCheckEraseMixin'] diff --git a/tests/test_company.py b/tests/test_company.py index 848cd2ea11..2af17c489e 100644 --- a/tests/test_company.py +++ b/tests/test_company.py @@ -9,6 +9,7 @@ from trytond.transaction import Transaction from trytond.pool import Pool from trytond.modules.currency.tests import create_currency, add_currency_rate +from trytond.modules.party.tests import PartyCheckEraseMixin def create_company(name='Dunder Mifflin', currency=None): @@ -55,7 +56,14 @@ def set_company(company): yield -class CompanyTestCase(ModuleTestCase): +class PartyCompanyCheckEraseMixin(PartyCheckEraseMixin): + + def setup_check_erase_party(self): + create_company() + return super().setup_check_erase_party() + + +class CompanyTestCase(PartyCompanyCheckEraseMixin, ModuleTestCase): 'Test Company module' module = 'company'