Esempio n. 1
0
def test_search_query_with_spires_syntax_in_authors_search():
    query_string = u"a First Middle Last"
    expected_query = Q('match', _all=query_string).to_dict()

    search = AuthorsSearch().query_from_iq(query_string)
    search_dict = search.to_dict()
    query = search_dict['query']

    assert query == expected_query
Esempio n. 2
0
def test_empty_search_query_in_authors_search():
    query_string = ""
    expected_query = Q().to_dict()

    search = AuthorsSearch().query_from_iq(query_string)
    search_dict = search.to_dict()
    query = search_dict['query']

    assert query == expected_query
Esempio n. 3
0
def test_select_source_function_in_author_search():
    search = select_source(AuthorsSearch())
    search_source = search.to_dict().get('_source')

    assert search_source is None