refactor, add more tests #2516

This commit is contained in:
Timotheus Kampik
2016-05-02 07:54:44 +02:00
parent a8dabf334d
commit 6f6b28d3e6
7 changed files with 38 additions and 23 deletions

View File

@@ -53,10 +53,22 @@ def test_objects_are_escaped(app, status, warning):
index = jsdump.loads(searchindex[16:-2])
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(app, status, warning):
def test_meta_keys_are_handled_for_language_en(app, status, warning):
app.builder.build_all()
searchindex = (app.outdir / 'searchindex.js').text()
assert 'findnotthiskey' not in searchindex
assert_lang_agnostic_key_words(searchindex)
assert 'findthiskei' in searchindex
assert 'thisonetoo' in searchindex
@with_app(testroot='search-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