From a52c69046931c46fb73791aee8b0797c0d38cc94 Mon Sep 17 00:00:00 2001 From: Tom Date: Wed, 3 May 2017 14:54:10 +0200 Subject: [PATCH] test --- base_partner_merge/tests/__init__.py | 3 ++ base_partner_merge/tests/test_merge.py | 52 ++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 base_partner_merge/tests/__init__.py create mode 100644 base_partner_merge/tests/test_merge.py diff --git a/base_partner_merge/tests/__init__.py b/base_partner_merge/tests/__init__.py new file mode 100644 index 000000000..b4368a398 --- /dev/null +++ b/base_partner_merge/tests/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +from . import test_merge \ No newline at end of file diff --git a/base_partner_merge/tests/test_merge.py b/base_partner_merge/tests/test_merge.py new file mode 100644 index 000000000..842b4aa72 --- /dev/null +++ b/base_partner_merge/tests/test_merge.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# © 2017 Sunflower IT +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). + +import os +from openerp.tests.common import TransactionCase + +class PartnerMergeTestCase(TransactionCase): + """Tests for Partner Merge""" + + def setUp(self): + super(PartnerMergeTestCase, self).setUp() + self.partner = self.env['res.partner'] + self.merge_wizard = \ + self.env['base.partner.merge.automatic.wizard'] + + def test_10_all_functionality(self): + # Delete all Donald Ducks + donald_domain = [('name', '=', 'Donald Duck')] + self.partner.search(donald_domain).unlink() + + # Create two partners called Donald Duck + partner_donald = self.partner.create({ + 'name': 'Donald Duck', + 'email': 'donald@sunflowerweb.nl', + }) + partner_donald2 = self.partner.create({ + 'name': 'Donald Duck', + 'email': 'donald@therp.nl', + }) + + # Test if there are two Donald Ducks + donalds = self.partner.search(donald_domain) + self.assertEquals(len(donalds), 2) + + # Merge them, + wizard_id = self.merge_wizard.create({ + 'group_by_name': True, + 'state': "option" + }) + wizard_id.automatic_process_cb() + + # Test if there is now one Donald Duck + donalds = self.partner.search(donald_domain) + self.assertEquals(len(donalds), 1) + + # Delete all Donald Ducks + self.partner.search(donald_domain).unlink() + + + +