Populate station list from search results to prevent unnecessary api requests

This commit is contained in:
Eric van Blokland
2021-09-09 01:19:59 +02:00
parent 10ead80966
commit 155f063ecc
5 changed files with 129 additions and 47 deletions

View File

@@ -142,6 +142,7 @@ def test_browse_favorites(library):
assert 1 == len(results)
def test_search(library):
result = library.search({'any': ['radio ram']})
@@ -151,4 +152,13 @@ def test_search(library):
result = library.search({'any': ['radio ram']})
assert len(result.tracks) == old_length
assert len(result.tracks) == old_length
def test_lookup(library):
results = library.browse('radionet:favorites');
assert 1 == len(results)
for result in results:
assert library.lookup(result.uri) is not None

View File

@@ -20,11 +20,15 @@ def test_do_search(radionet):
result = radionet.do_search("radio ram")
assert len(result) > 0
assert result[0].stream_url is None
assert radionet.get_stream_url(result[0].id) is not None
def test_get_favorites(radionet):
test_favorites = ("Rock Antenne", "radio ram", "eska")
test_favorites = ("Rock Antenne", "radio ram", "eska", "dancefm")
radionet.set_favorites(test_favorites)
result = radionet.get_favorites()
assert len(result) == len(test_favorites)
assert result[2].name == 'Eska'
assert result[2].name == 'Eska'