changeset 5001:2b00cc68f8c2

Xapian2009: BaseSearchTest.test_create_page() tests that pages created by create_page are indexed and available for searching.
author Dmitrijs Milajevs <dimazest@gmail.com>
date Wed, 12 Aug 2009 19:41:32 +0200
parents 52f2454de7ab
children e64a9fe80f6d
files MoinMoin/search/_tests/test_search.py
diffstat 1 files changed, 17 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/search/_tests/test_search.py	Tue Aug 11 23:56:03 2009 +0200
+++ b/MoinMoin/search/_tests/test_search.py	Wed Aug 12 19:41:32 2009 +0200
@@ -8,7 +8,7 @@
 """
 
 
-import py, os
+import py, os, time
 
 from MoinMoin.search import QueryError
 from MoinMoin.search.queryparser import QueryParser
@@ -253,6 +253,18 @@
         result = self.search(query)
         assert len(result.hits) == 1
 
+    def test_create_page(self):
+        self.pages['TestCreatePage'] = 'some text' # Moin serarch must search this page
+        create_page(self.request, 'TestCreatePage', self.pages['TestCreatePage'])
+        time.sleep(1) # Wait while created pages are being indexed in other thread.
+        result = self.search(u'TestCreatePage')
+
+        nuke_page(self.request, 'TestCreatePage')
+        time.sleep(1) # Wait while the xapian index is being updated.
+        del self.pages['TestCreatePage']
+
+        assert len(result.hits) == 1
+
 
 class TestMoinSearch(BaseSearchTest):
 
@@ -264,6 +276,10 @@
 class TestXapianSearch(BaseSearchTest):
     """ search: test Xapian indexing """
 
+    class Config(wikiconfig.Config):
+
+        xapian_search = True
+
     def get_searcher(self, query):
         return XapianSearch(self.request, query)