##// END OF EJS Templates
search: fixed search tests
super-admin -
r5113:9cd499cc default
parent child Browse files
Show More
@@ -178,7 +178,10 b' class TestSearchController(TestControlle'
178 def test_filters_are_not_applied_for_admin_user(self):
178 def test_filters_are_not_applied_for_admin_user(self):
179 self.log_user()
179 self.log_user()
180 with mock.patch('whoosh.searching.Searcher.search') as search_mock:
180 with mock.patch('whoosh.searching.Searcher.search') as search_mock:
181
181 search_mock.return_value = mock.MagicMock(
182 scored_length=lambda: 100,
183 runtime=10
184 )
182 self.app.get(route_path('search'),
185 self.app.get(route_path('search'),
183 {'q': 'test query', 'type': 'commit'})
186 {'q': 'test query', 'type': 'commit'})
184 assert search_mock.call_count == 1
187 assert search_mock.call_count == 1
@@ -188,6 +191,10 b' class TestSearchController(TestControlle'
188 def test_filters_are_applied_for_normal_user(self, enabled_backends):
191 def test_filters_are_applied_for_normal_user(self, enabled_backends):
189 self.log_user(TEST_USER_REGULAR_LOGIN, TEST_USER_REGULAR_PASS)
192 self.log_user(TEST_USER_REGULAR_LOGIN, TEST_USER_REGULAR_PASS)
190 with mock.patch('whoosh.searching.Searcher.search') as search_mock:
193 with mock.patch('whoosh.searching.Searcher.search') as search_mock:
194 search_mock.return_value = mock.MagicMock(
195 scored_length=lambda: 100,
196 runtime=10
197 )
191 self.app.get(route_path('search'),
198 self.app.get(route_path('search'),
192 {'q': 'test query', 'type': 'commit'})
199 {'q': 'test query', 'type': 'commit'})
193 assert search_mock.call_count == 1
200 assert search_mock.call_count == 1
@@ -129,7 +129,7 b' class WhooshSearcher(BaseSearcher):'
129 original_query = query
129 original_query = query
130 query = self._extend_query(query)
130 query = self._extend_query(query)
131
131
132 log.debug(u'QUERY: %s on %s', query, document_type)
132 log.debug('QUERY: %s on %s', query, document_type)
133 result = {
133 result = {
134 'results': [],
134 'results': [],
135 'count': 0,
135 'count': 0,
General Comments 0
You need to be logged in to leave comments. Login now