X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/442e7667f2d3ae96b873dacc1c7f980765ecc57a..907aba88951334676a259dccc8f7edd8934d5e00:/src/search/mock_search.py diff --git a/src/search/mock_search.py b/src/search/mock_search.py index 344e79f72..118078f9d 100644 --- a/src/search/mock_search.py +++ b/src/search/mock_search.py @@ -1,8 +1,7 @@ -# -*- coding: utf-8 -*- # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later. # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. # -from mock import Mock +from unittest.mock import Mock from catalogue.models import Book, Tag from random import randint, choice @@ -24,7 +23,7 @@ class Search(Mock): def _find_some_books(query_terms=None, max_results=20): from .index import SearchResult - qs = Book.objects.order_by('?') + qs = Book.objects.filter(findable=True).order_by('?') results = [] for book in qs[:randint(1, max_results)]: doc = {