From 6676333ae38efc00f4f0bc592668b7fb291592a6 Mon Sep 17 00:00:00 2001 From: Daniel Reis Date: Wed, 6 Jul 2016 13:56:36 +0100 Subject: [PATCH] Test if additional domain is honored --- base_name_search_improved/tests/test_name_search.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/base_name_search_improved/tests/test_name_search.py b/base_name_search_improved/tests/test_name_search.py index 408db3eb5..72dd9933c 100644 --- a/base_name_search_improved/tests/test_name_search.py +++ b/base_name_search_improved/tests/test_name_search.py @@ -17,12 +17,15 @@ class NameSearchCase(TransactionCase): self.Partner = self.env['res.partner'] self.partner1 = self.Partner.create( {'name': 'Luigi Verconti', + 'customer': True, 'phone': '+351 555 777 333'}) self.partner2 = self.Partner.create( {'name': 'Ken Shabby', + 'customer': True, 'phone': '+351 555 333 777'}) self.partner3 = self.Partner.create( {'name': 'Johann Gambolputty of Ulm', + 'supplier': True, 'phone': '+351 777 333 555'}) def test_RelevanceOrderedResults(self): @@ -42,3 +45,10 @@ class NameSearchCase(TransactionCase): """Must Match All Words""" res = self.Partner.name_search('ulm 555 777') self.assertFalse(res) + + def test_MustHonorDomain(self): + """Must also honor a provided Domain""" + res = self.Partner.name_search('+351', args=[('supplier', '=', True)]) + gambulputty = self.partner3.id + self.assertEqual(len(res), 1) + self.assertEqual(res[0][0], gambulputty)