@pytest.mark.parametrize('es_filter_fields, query_params, expected', [([ESFieldFilter('active', 'is_active')], {'active': 'False'}, [3, 6, 8, 10]), ([ESFieldFilter('birthday')], {'birthday': '1985-03-17T12:20:09'}, [1]), ([ESFieldFilter('skills')], {'skills': 'python'}, [1, 4, 5, 10]), ([ESFieldFilter('skills')], {'skills': 'python,ruby'}, [1, 4, 5, 6, 10]), ([ESFieldFilter('active', 'is_active')], {'active': 'False', 'skills': 'python'}, [3, 6, 8, 10]), ([ESFieldFilter('active', 'is_active')], {'active': 'False', 'skills': 'python'}, [3, 6, 8, 10]), ([ESFieldFilter('score')], {'score': '200'}, [2, 13])])
def test_filter_search(self, search, es_filter_fields, query_params, expected):
    view = self.create_view(es_filter_fields)
    request = rf.get('/test/')
    request.query_params = query_params
    search = self.backend.filter_search(request, search, view)
    result = get_search_ids(search)
    assert (sorted(result) == sorted(expected))
@pytest.mark.parametrize('es_filter_fields, query_params, expected', [([ESFieldFilter('active', 'is_active')], {'active': 'False'}, [3, 6, 8, 10]), ([ESFieldFilter('birthday')], {'birthday': '1985-03-17T12:20:09'}, [1]), ([ESFieldFilter('skills')], {'skills': 'python'}, [1, 4, 5, 10]), ([ESFieldFilter('skills')], {'skills': 'python,ruby'}, [1, 4, 5, 6, 10]), ([ESFieldFilter('active', 'is_active')], {'active': 'False', 'skills': 'python'}, [3, 6, 8, 10]), ([ESFieldFilter('active', 'is_active')], {'active': 'False', 'skills': 'python'}, [3, 6, 8, 10]), ([ESFieldFilter('score')], {'score': '200'}, [2, 13])])
def test_filter_search(self, search, es_filter_fields, query_params, expected):
    view = self.create_view(es_filter_fields)
    request = rf.get('/test/')
    request.query_params = query_params
    search = self.backend.filter_search(request, search, view)
    result = get_search_ids(search)
    assert (sorted(result) == sorted(expected))