Browse Source

test

pull/441/head
Tom 8 years ago
committed by Holger Brunn
parent
commit
a52c690469
No known key found for this signature in database GPG Key ID: 1C9760FECA3AE18
  1. 3
      base_partner_merge/tests/__init__.py
  2. 52
      base_partner_merge/tests/test_merge.py

3
base_partner_merge/tests/__init__.py

@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-
from . import test_merge

52
base_partner_merge/tests/test_merge.py

@ -0,0 +1,52 @@
# -*- coding: utf-8 -*-
# © 2017 Sunflower IT <http://sunflowerweb.nl>
# 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()
Loading…
Cancel
Save