changeset afd110144f0e in modules/party:default
details: https://hg.tryton.org/modules/party?cmd=changeset;node=afd110144f0e
description:
        Add generic test for check erase party

        issue9895
        review324571002
diffstat:

 tests/__init__.py   |   7 ++++---
 tests/test_party.py |  26 +++++++++++++++++++++++++-
 2 files changed, 29 insertions(+), 4 deletions(-)

diffs (52 lines):

diff -r 536b7671a760 -r afd110144f0e tests/__init__.py
--- a/tests/__init__.py Thu Dec 03 21:22:45 2020 +0100
+++ b/tests/__init__.py Sat Dec 05 11:53:48 2020 +0100
@@ -2,8 +2,9 @@
 # this repository contains the full copyright notices and license terms.
 
 try:
-    from trytond.modules.party.tests.test_party import suite
+    from trytond.modules.party.tests.test_party import (
+        suite, PartyCheckEraseMixin)
 except ImportError:
-    from .test_party import suite
+    from .test_party import suite, PartyCheckEraseMixin
 
-__all__ = ['suite']
+__all__ = ['suite', 'PartyCheckEraseMixin']
diff -r 536b7671a760 -r afd110144f0e tests/test_party.py
--- a/tests/test_party.py       Thu Dec 03 21:22:45 2020 +0100
+++ b/tests/test_party.py       Sat Dec 05 11:53:48 2020 +0100
@@ -16,7 +16,31 @@
 from trytond.transaction import Transaction
 
 
-class PartyTestCase(ModuleTestCase):
+class PartyCheckEraseMixin:
+
+    @with_transaction()
+    def test_check_erase_party(self):
+        "Test check erase of party"
+        pool = Pool()
+        Erase = pool.get('party.erase', type='wizard')
+        Session = pool.get('ir.session.wizard')
+        party = self.setup_check_erase_party()
+
+        session = Session()
+        session.save()
+
+        Erase(session.id).check_erase(party)
+
+    def setup_check_erase_party(self):
+        pool = Pool()
+        Party = pool.get('party.party')
+
+        party = Party(active=False)
+        party.save()
+        return party
+
+
+class PartyTestCase(PartyCheckEraseMixin, ModuleTestCase):
     'Test Party module'
     module = 'party'
 

Reply via email to