Exemplo n.º 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
Exemplo n.º 2
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
Exemplo n.º 3
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
Exemplo n.º 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