Browse Source

Test if additional domain is honored

pull/621/head
Daniel Reis 9 years ago
committed by Nicolas Mac Rouillon
parent
commit
8557257520
  1. 10
      base_name_search_improved/tests/test_name_search.py

10
base_name_search_improved/tests/test_name_search.py

@ -17,12 +17,15 @@ class NameSearchCase(TransactionCase):
self.Partner = self.env['res.partner'] self.Partner = self.env['res.partner']
self.partner1 = self.Partner.create( self.partner1 = self.Partner.create(
{'name': 'Luigi Verconti', {'name': 'Luigi Verconti',
'customer': True,
'phone': '+351 555 777 333'}) 'phone': '+351 555 777 333'})
self.partner2 = self.Partner.create( self.partner2 = self.Partner.create(
{'name': 'Ken Shabby', {'name': 'Ken Shabby',
'customer': True,
'phone': '+351 555 333 777'}) 'phone': '+351 555 333 777'})
self.partner3 = self.Partner.create( self.partner3 = self.Partner.create(
{'name': 'Johann Gambolputty of Ulm', {'name': 'Johann Gambolputty of Ulm',
'supplier': True,
'phone': '+351 777 333 555'}) 'phone': '+351 777 333 555'})
def test_RelevanceOrderedResults(self): def test_RelevanceOrderedResults(self):
@ -42,3 +45,10 @@ class NameSearchCase(TransactionCase):
"""Must Match All Words""" """Must Match All Words"""
res = self.Partner.name_search('ulm 555 777') res = self.Partner.name_search('ulm 555 777')
self.assertFalse(res) 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)
Loading…
Cancel
Save