privacore-open-source-searc.../test/system/test_search_terms.py
2016-03-07 17:29:44 +01:00

19 lines
626 B
Python

import pytest
@pytest.mark.parametrize('query, expected_terms', [
# query expected
('the one', ['the one', 'the', 'one', '1']),
('to be or not to be', ['to be', 'be or', 'or not', 'not to', 'to', 'be', 'or']),
('html', ['html', 'Hypertext Markup Language'])
])
def test_search_terms(gb_api, query, expected_terms):
result = gb_api.search(query)
result_terms = []
for result_term in result['queryInfo']['terms']:
result_terms.append(result_term['termStr'])
for expected_term in expected_terms:
assert expected_term in result_terms