# HG changeset patch # User Dmitrijs Milajevs # Date 1250022626 -7200 # Node ID 605b2da7765e705db22253ffc8a26f3ca12d7b88 # Parent 1d7a28cfc0f6b24bc8d74a34076450bfac5494d1 Xapian2009: Test for xapian search was added which checks that index consists all required pages. diff -r 1d7a28cfc0f6 -r 605b2da7765e MoinMoin/search/_tests/test_search.py --- a/MoinMoin/search/_tests/test_search.py Mon Aug 10 21:30:54 2009 +0200 +++ b/MoinMoin/search/_tests/test_search.py Tue Aug 11 22:30:26 2009 +0200 @@ -258,6 +258,10 @@ def get_searcher(self, query): return XapianSearch(self.request, query) + def get_moin_search_connection(self): + from MoinMoin.search.Xapian import MoinSearchConnection + return MoinSearchConnection('tests/wiki/data/cache/xapian/index') # XXX Index location should not be hardcoded! + def setup_method(self, method): try: @@ -272,12 +276,18 @@ def teardown_method(self, method): nuke_xapian_index(self.request) - def test_xapian_term(self): + def test_get_all_documents(self): + connection = self.get_moin_search_connection() + documents = connection.get_all_documents() - from MoinMoin.search.Xapian import MoinSearchConnection + assert len(self.pages) == len(documents) + for document in documents: + assert document.data['pagename'][0] in self.pages.keys() + def test_xapian_term(self): parser = QueryParser() - connection = MoinSearchConnection('tests/wiki/data/cache/xapian/index') # XXX Index location should not be hardcoded! + connection = self.get_moin_search_connection() + prefixes = {'title:': ['', 're:', 'case:', 'case:re:'], 'linkto:': ['', 're:', 'case:', 'case:re:'], 'category:': ['re:', 'case:', 'case:re:'],