image listings / boxes work but need polishing. started coding the viewer.
[wolnelektury.git] / apps / opds / tests / __init__.py
index d6e9ca0..856f2f2 100755 (executable)
@@ -6,6 +6,7 @@ from catalogue.test_utils import (BookInfoStub, PersonStub, info_args,
         WLTestCase, get_fixture)
 from catalogue.models import Book
 from librarian import WLURI, XMLNamespace
         WLTestCase, get_fixture)
 from catalogue.models import Book
 from librarian import WLURI, XMLNamespace
+from search import Index, Search
 
 AtomNS = XMLNamespace("http://www.w3.org/2005/Atom")
 
 
 AtomNS = XMLNamespace("http://www.w3.org/2005/Atom")
 
@@ -14,6 +15,10 @@ class OpdsSearchTests(WLTestCase):
     """Tests search feed in OPDS.."""
     def setUp(self):
         WLTestCase.setUp(self)
     """Tests search feed in OPDS.."""
     def setUp(self):
         WLTestCase.setUp(self)
+        index = Index()
+        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'))
         with self.settings(NO_SEARCH_INDEX=False):
             self.do_doktora = Book.from_xml_file(
                 get_fixture('do-doktora.xml'))
@@ -40,7 +45,7 @@ class OpdsSearchTests(WLTestCase):
         both = set([self.do_doktora, self.do_anusie])
         self.assert_finds('title=fraszka', both)
         self.assert_finds('title=fraszka', both)
         both = set([self.do_doktora, self.do_anusie])
         self.assert_finds('title=fraszka', both)
         self.assert_finds('title=fraszka', both)
-        self.assert_finds('q=title:fraszka', [self.do_doktora])
+        self.assert_finds('q=title:doktora', [self.do_doktora])
 
     def test_opds_search_author(self):
         """Search by author."""
 
     def test_opds_search_author(self):
         """Search by author."""