def test_gets_downloadable_results(app): """Tests we get only downloadable results""" with app.app_context(): db = get_db() setup_search(db) with db.scoped_session() as session: res = track_search_query(session, "the track", 10, 0, False, False, None, True) assert len(res) == 1
def test_gets_all_results(app): """Tests we get all results, including downloaded""" with app.app_context(): db = get_db() setup_search(db) with db.scoped_session() as session: res = track_search_query(session, "the track", 10, 0, False, False, None, False) assert len(res) == 2
def test_get_autocomplete_tracks(app_module): """Tests we get all tracks with autocomplete""" with app_module.app_context(): db = get_db() with db.scoped_session() as session: res = track_search_query(session, "the track", 10, 0, True, None, False) assert len(res["all"]) == 2 assert len(res["saved"]) == 0 search_args = { "is_auto_complete": True, "kind": "tracks", "query": "the track", "current_user_id": None, "with_users": True, "limit": 10, "offset": 0, "only_downloadable": False, } es_res = search_es_full(search_args) assert len(es_res["tracks"]) == 2