changeset 4996:0e4eff722cac

Xapian2009: Test for xapian_term builds queries which should not be empty, it also checks queries like 'case:moin' (without specified prefix like language:)
author Dmitrijs Milajevs <dimazest@gmail.com>
date Tue, 11 Aug 2009 23:19:17 +0200
parents 77496dd99338
children 8b51025823e0
files MoinMoin/search/_tests/test_search.py
diffstat 1 files changed, 11 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/search/_tests/test_search.py	Tue Aug 11 23:14:52 2009 +0200
+++ b/MoinMoin/search/_tests/test_search.py	Tue Aug 11 23:19:17 2009 +0200
@@ -293,21 +293,22 @@
         parser = QueryParser()
         connection = self.get_moin_search_connection()
 
-        prefixes = {'title:': ['', 're:', 'case:', 'case:re:'],
-                    'linkto:': ['', 're:', 'case:', 'case:re:'],
-                    'category:': ['re:', 'case:', 'case:re:'],
-                    'mimetype:': ['re:'],
-                    'language:': [''],
-                    'domain:': ['']}
+        prefixes = {'': (['', 're:', 'case:', 'case:re:'], 'SearchTestPage'),
+                    'title:': (['', 're:', 'case:', 'case:re:'], 'SearchTestPage'),
+                    'linkto:': (['', 're:', 'case:', 'case:re:'], 'FrontPage'),
+                    'category:': (['', 're:', 'case:', 'case:re:'], 'CategoryHomepage'),
+                    'mimetype:': (['', 're:'], 'text/creole'),
+                    'language:': ([''], 'en'),
+                    'domain:': ([''], 'system')}
 
         def test_query(query):
-            print query
             assert not parser.parse_query(query).xapian_term(self.request, connection).empty()
 
-        for prefix, modifiers in prefixes.iteritems():
+        for prefix, data in prefixes.iteritems():
+            modifiers, term = data
             for modifier in modifiers:
-                query = ''.join([prefix, modifier, 'something'])
-                yield test_query, query
+                query = ''.join([prefix, modifier, term])
+                yield query, test_query, query
 
 class TestXapianIndexingInNewThread(object):
     """ search: test Xapian indexing """