changeset 5641:a0fdc0e059cc

test_search: xapian search test for regex content search
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Fri, 02 Apr 2010 21:15:30 +0200
parents 3cb7a64eaef5
children 226e1b0aa79c
files MoinMoin/search/_tests/test_search.py
diffstat 1 files changed, 19 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/search/_tests/test_search.py	Fri Apr 02 19:54:22 2010 +0200
+++ b/MoinMoin/search/_tests/test_search.py	Fri Apr 02 21:15:30 2010 +0200
@@ -465,6 +465,25 @@
         test_result = len(result.hits)
         assert test_result == 1
 
+    def test_regex_content_search_in_new_page(self):
+        self.pages['ContentTestCreatePage'] = 'M01nM01n 1s 4n 4dv4nc3d, 34sy t0 us3 4nd 3xt3ns1bl3 W1k13ng1n3' # Xapian search must search this page
+        try:
+            create_page(self.request, 'ContentTestCreatePage', self.pages['ContentTestCreatePage'])
+            self._index_update()
+            search_result = self.search(u'-domain:underlay -domain:system re:M01n.*')
+            test_result = len(search_result.hits)
+            for title in search_result.hits:
+                assert title.page_name == 'ContentTestCreatePage'
+            test_result = len(search_result.hits)
+            assert test_result == 1
+        finally:
+            nuke_page(self.request, 'ContentTestCreatePage')
+            self._index_update()
+            del self.pages['ContentTestCreatePage']
+            result = self.search(u'-domain:underlay -domain:system ContentTestCreatePage')
+            test_result = len(result.hits)
+            assert test_result == 0
+
 
 class TestXapianSearchStemmed(TestXapianSearch):
     class Config(wikiconfig.Config):