def test_c_more_like_this_no_filters(mocked_extract, mocked_reqs, mocked_json, mlt_kwargs, mlt_query): # Make an input query fixture and output query fixture c_more_like_this(endpoint='someurl.com', **mlt_kwargs) args, kwargs = mocked_reqs.post.call_args assert len(args) == 0 assert set(kwargs) == set(['url', 'data', 'params']) query = kwargs['data'] assert query.pop('from') == mlt_kwargs['offset'] assert query.pop('size') == mlt_kwargs['limit'] assert query['query']['bool'].pop('filter') == [] assert query == mlt_query
def test_c_more_like_this_zero_total(mocked_extract, mocked_reqs, mocked_json, mlt_kwargs, mlt_query): mlt_kwargs['total'] = 0 # Make an input query fixture and output query fixture total, docs = c_more_like_this(endpoint='someurl.com', **mlt_kwargs) assert total == 0 assert docs == []