示例#1
0
def get_files(query):
    """Perform query for every configured quality and return all results"""
    results = []
    for q in query_expand(query, CONFIG.quality):
        for entry in api.search(q):
            file_ = File(**entry)
            if file_.matches_query(q):
                results.append(file_)
    return results
示例#2
0
def test_search_ok():
    files = api.search('linux iso', limit=2)
    assert len(files) == 2
    assert files[0]['ident'] == '5Vw5vv6H47'
    assert files[0]['name'] == '2mini linux.iso'
    assert files[0]['type'] == 'iso'
    assert int(files[0]['size']) == 111149056
    assert int(files[0]['positive_votes']) == 0
    assert int(files[0]['negative_votes']) == 0
    assert files[1]['ident'] == 'xsxy0Io3Qg'
示例#3
0
def test_search_fatal():
    with pytest.raises(Exception):
        api.search('')
示例#4
0
def test_search_no_result():
    files = api.search('')
    assert len(files) == 0