diff options
author | Jacob Mason <jacoblmason@gmail.com> | 2010-07-31 12:23:26 -0500 |
---|---|---|
committer | Jacob Mason <jacoblmason@gmail.com> | 2010-07-31 12:23:26 -0500 |
commit | a31f3b7e73f2050efab07a9ed143c72e774af452 (patch) | |
tree | f6749c033ab94d56285b000d7fe9e866a429aea7 /tests/test_websupport.py | |
parent | a36175298e252c4a92902e5c35a5f52ec35edaab (diff) | |
download | sphinx-git-a31f3b7e73f2050efab07a9ed143c72e774af452.tar.gz |
More complete tests for search adapters.
Diffstat (limited to 'tests/test_websupport.py')
-rw-r--r-- | tests/test_websupport.py | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/tests/test_websupport.py b/tests/test_websupport.py index 3d61e55c2..3f352cd6c 100644 --- a/tests/test_websupport.py +++ b/tests/test_websupport.py @@ -78,9 +78,32 @@ def search_adapter_helper(adapter): settings.update({'srcdir': test_root, 'search': adapter}) support = WebSupport(**settings) - support.build() + s = support.search + + # Test the adapters query method. A search for "Epigraph" should return + # one result. + results = s.query(u'Epigraph') + assert len(results) == 1, \ + '%s search adapter returned %s search result(s), should have been 1'\ + % (adapter, len(results)) + + # Make sure documents are properly updated by the search adapter. + s.init_indexing(changed=['markup']) + s.add_document(u'markup', u'title', u'SomeLongRandomWord') + s.finish_indexing() + # Now a search for "Epigraph" should return zero results. + results = s.query(u'Epigraph') + assert len(results) == 0, \ + '%s search adapter returned %s search result(s), should have been 0'\ + % (adapter, len(results)) + # A search for "SomeLongRandomWord" should return one result. + results = s.query(u'SomeLongRandomWord') + assert len(results) == 1, \ + '%s search adapter returned %s search result(s), should have been 1'\ + % (adapter, len(results)) + def test_xapian(): # Don't run tests if xapian is not installed. |