def test_recommend_uses_mostpopular_if_no_seed_is_specified(monkeypatch): class MockFinder: @classmethod def get_candidates(cls, s, seed, n): return [] monkeypatch.setattr(api, 'finder_map', {'mostpopular': MockFinder}) args = api.parse_and_validate_args(dict(s='xx', t='yy')) args['search'] = 'customsearch' result = api.recommend(**args) assert [] == result
def test_recommend(monkeypatch): class MockFinder: @classmethod def get_candidates(cls, s, seed, n): return [] monkeypatch.setattr(api, 'finder_map', {'customsearch': MockFinder}) args = api.parse_and_validate_args(dict(s='xx', t='yy', article='Something')) args['search'] = 'customsearch' result = api.recommend(**args) assert [] == result
def test_recommend(monkeypatch): class MockFinder: @classmethod def get_candidates(cls, s, seed, n): return [] monkeypatch.setattr(api, 'finder_map', {'customsearch': MockFinder}) args = api.parse_and_validate_args( dict(s='xx', t='yy', article='Something')) args['search'] = 'customsearch' result = api.recommend(**args) assert [] == result
def test_default_params(params): args = api.parse_and_validate_args(params) assert 12 == args['count'] assert '' is args['seed'] assert True is args['include_pageviews'] assert 'morelike' == args['search']