summaryrefslogtreecommitdiff
path: root/tests/test_search.py
diff options
context:
space:
mode:
authorTimotheus Kampik <timotheus.kampik@signavio.com>2016-05-05 18:09:22 +0200
committerTimotheus Kampik <timotheus.kampik@signavio.com>2016-05-05 18:09:22 +0200
commit01797faedec6346f3bfb574e963ef3c91e8fbbf5 (patch)
tree96a9b7e8b43904c8c8743520a43e561dec1b78ab /tests/test_search.py
parent6f6b28d3e69425d61678c09cf82ee225a7b75d83 (diff)
downloadsphinx-git-01797faedec6346f3bfb574e963ef3c91e8fbbf5.tar.gz
refactor code/tests: keyword support for search index #2516
Diffstat (limited to 'tests/test_search.py')
-rw-r--r--tests/test_search.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/test_search.py b/tests/test_search.py
index 033e7ccb4..160dd1827 100644
--- a/tests/test_search.py
+++ b/tests/test_search.py
@@ -8,6 +8,7 @@
:copyright: Copyright 2007-2016 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
+import os
from docutils import frontend, utils
from docutils.parsers import rst
@@ -54,21 +55,24 @@ def test_objects_are_escaped(app, status, warning):
assert 'n::Array&lt;T, d&gt;' in index.get('objects').get('') # n::Array<T,d> is escaped
def assert_lang_agnostic_key_words(searchindex):
- assert 'findnotthiskey' not in searchindex
assert 'thisnoteith' not in searchindex
- assert 'thistoo' in searchindex
assert 'thisonetoo' in searchindex
@with_app(testroot='search')
def test_meta_keys_are_handled_for_language_en(app, status, warning):
+ os.remove(app.outdir / 'searchindex.js')
app.builder.build_all()
searchindex = (app.outdir / 'searchindex.js').text()
assert_lang_agnostic_key_words(searchindex)
assert 'findthiskei' in searchindex
+ assert 'onlygerman' not in searchindex
+ assert 'thistoo' in searchindex
-@with_app(testroot='search-de')
+@with_app(testroot='search', confoverrides={'html_search_language': 'de'})
def test_meta_keys_are_handled_for_language_de(app, status, warning):
app.builder.build_all()
searchindex = (app.outdir / 'searchindex.js').text()
assert_lang_agnostic_key_words(searchindex)
- assert 'findthiskey' in searchindex \ No newline at end of file
+ assert 'onlygerman' in searchindex
+ assert 'notgerman' not in searchindex
+ assert 'onlytoogerman' in searchindex \ No newline at end of file