# HG changeset patch # User RhodeCode Admin # Date 2023-07-27 08:22:54 # Node ID 9cd499cc867465914929ca39d5a896610eae0286 # Parent 50a51f17140b2943b9a8ad1901c5c9e8f22da371 search: fixed search tests diff --git a/rhodecode/apps/search/tests/test_search.py b/rhodecode/apps/search/tests/test_search.py --- a/rhodecode/apps/search/tests/test_search.py +++ b/rhodecode/apps/search/tests/test_search.py @@ -178,7 +178,10 @@ class TestSearchController(TestControlle 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(TestControlle 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 diff --git a/rhodecode/lib/index/whoosh.py b/rhodecode/lib/index/whoosh.py --- a/rhodecode/lib/index/whoosh.py +++ b/rhodecode/lib/index/whoosh.py @@ -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,