search: fixed search tests
This commit is contained in:
parent
dbdf7a5bf0
commit
dc3bda19d3
2 changed files with 9 additions and 2 deletions
|
|
@ -178,7 +178,10 @@ class TestSearchController(TestController):
|
|||
def test_filters_are_not_applied_for_admin_user(self):
|
||||
self.log_user()
|
||||
with mock.patch('whoosh.searching.Searcher.search') as search_mock:
|
||||
|
||||
search_mock.return_value = mock.MagicMock(
|
||||
scored_length=lambda: 100,
|
||||
runtime=10
|
||||
)
|
||||
self.app.get(route_path('search'),
|
||||
{'q': 'test query', 'type': 'commit'})
|
||||
assert search_mock.call_count == 1
|
||||
|
|
@ -188,6 +191,10 @@ class TestSearchController(TestController):
|
|||
def test_filters_are_applied_for_normal_user(self, enabled_backends):
|
||||
self.log_user(TEST_USER_REGULAR_LOGIN, TEST_USER_REGULAR_PASS)
|
||||
with mock.patch('whoosh.searching.Searcher.search') as search_mock:
|
||||
search_mock.return_value = mock.MagicMock(
|
||||
scored_length=lambda: 100,
|
||||
runtime=10
|
||||
)
|
||||
self.app.get(route_path('search'),
|
||||
{'q': 'test query', 'type': 'commit'})
|
||||
assert search_mock.call_count == 1
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ class WhooshSearcher(BaseSearcher):
|
|||
original_query = query
|
||||
query = self._extend_query(query)
|
||||
|
||||
log.debug(u'QUERY: %s on %s', query, document_type)
|
||||
log.debug('QUERY: %s on %s', query, document_type)
|
||||
result = {
|
||||
'results': [],
|
||||
'count': 0,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue