X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/d157af1061e9f03f59ea909d7d25f4a0b41f1c0e..01ba89e7caab3e386df4b1a99a93b98a237a0457:/apps/opds/tests/__init__.py?ds=inline diff --git a/apps/opds/tests/__init__.py b/apps/opds/tests/__init__.py index 856f2f2e5..b1399aee7 100755 --- a/apps/opds/tests/__init__.py +++ b/apps/opds/tests/__init__.py @@ -1,16 +1,23 @@ # -*- 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 unittest import skipIf from lxml import etree +from django.conf import settings from django.core.files.base import ContentFile import catalogue from catalogue.test_utils import (BookInfoStub, PersonStub, info_args, WLTestCase, get_fixture) from catalogue.models import Book from librarian import WLURI, XMLNamespace -from search import Index, Search +from search.index import Index, Search AtomNS = XMLNamespace("http://www.w3.org/2005/Atom") +@skipIf(getattr(settings, 'NO_SEARCH_INDEX', False), + u'Requires search server and NO_SEARCH_INDEX=False.') class OpdsSearchTests(WLTestCase): """Tests search feed in OPDS..""" def setUp(self): @@ -19,11 +26,10 @@ class OpdsSearchTests(WLTestCase): index.index.delete_all() index.index.commit() - with self.settings(NO_SEARCH_INDEX=False): - self.do_doktora = Book.from_xml_file( - get_fixture('do-doktora.xml')) - self.do_anusie = Book.from_xml_file( - get_fixture('fraszka-do-anusie.xml', catalogue)) + self.do_doktora = Book.from_xml_file( + get_fixture('do-doktora.xml')) + self.do_anusie = Book.from_xml_file( + get_fixture('fraszka-do-anusie.xml', catalogue)) def assert_finds(self, query, books): """Takes a query and tests against books expected to be found."""