예제 #1
0
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
예제 #2
0
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
예제 #3
0
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
예제 #4
0
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
예제 #5
0
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']
예제 #6
0
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']