[FIX] test: correct Mock of search_read
[IMP] search_read: build order index using dict comprehension bzr revid: chs@openerp.com-20140123170836-4qu0ei6zucaprwxs
This commit is contained in:
parent
2f2c1057b3
commit
457d661ae0
|
@ -1085,9 +1085,7 @@ class DataSet(openerpweb.Controller):
|
|||
|
||||
records = Model.read(ids, fields or False, req.context)
|
||||
|
||||
index = {}
|
||||
for r in records:
|
||||
index[r['id']] = r
|
||||
index = dict((r['id'], r) for r in records)
|
||||
records = [index[x] for x in ids if x in index]
|
||||
|
||||
return {
|
||||
|
|
|
@ -22,6 +22,11 @@ class TestDataSetController(unittest2.TestCase):
|
|||
|
||||
def test_regular_find(self):
|
||||
self.search.return_value = [1, 2, 3]
|
||||
self.read.return_value = [
|
||||
{'id': 1, 'name': 'foo'},
|
||||
{'id': 2, 'name': 'bar'},
|
||||
{'id': 3, 'name': 'qux'}
|
||||
]
|
||||
|
||||
self.dataset.do_search_read(self.request, 'fake.model')
|
||||
self.read.assert_called_once_with(
|
||||
|
|
Loading…
Reference in New Issue