def test_searches_parsers_params_parser_filter_and_query_string_space( dummy_request): from snovault.elasticsearch.searches.parsers import ParamsParser dummy_request.environ['QUERY_STRING'] = ( 'type=File&status=released&file_type=bed+bed3%2B') p = ParamsParser(dummy_request) assert p.get_key_filters(key='file_type', params=p.get_must_match_filters()) == [ ('file_type', 'bed bed3+') ] assert p.get_search_term_filters() == [] assert p.get_query_string(params=p.get_search_term_filters()) == '' assert p.get_query_string(params=p.get_key_filters( key='file_type')) == 'file_type=bed+bed3%2B'
def test_searches_parsers_params_parser_get_search_term_filters_empty( dummy_request): from snovault.elasticsearch.searches.parsers import ParamsParser dummy_request.environ['QUERY_STRING'] = ( 'type=Experiment&type=File&field=status&type!=Item') p = ParamsParser(dummy_request) assert p.get_search_term_filters() == []
def test_searches_parsers_params_parser_get_search_term_filters(dummy_request): from snovault.elasticsearch.searches.parsers import ParamsParser dummy_request.environ['QUERY_STRING'] = ( 'type=Experiment&type=File&field=status&type!=Item' '&searchTerm=my+favorite+experiment&searchTerm=my+other+experiment' '&searchTerm!=whatever') p = ParamsParser(dummy_request) assert p.get_search_term_filters() == [ ('searchTerm', 'my favorite experiment'), ('searchTerm', 'my other experiment'), ('searchTerm!', 'whatever') ]