Changes for V5 api compatibility

This commit is contained in:
Eric van Blokland
2024-12-24 15:59:04 +01:00
parent 7b19c20269
commit 62bf24b9b5
6 changed files with 227 additions and 303 deletions

View File

@@ -1,12 +1,10 @@
def test_browse_root(library):
results = library.browse('radionet:root')
assert 8 == len(results)
assert 7 == len(results)
def test_browse_localstations(library):
results = library.browse('radionet:localstations')
results = library.browse('radionet:local')
assert len(results) > 0
page_uri = results[0].uri if results is not None else None
@@ -17,28 +15,23 @@ def test_browse_localstations(library):
# assert len(results) > 0
def test_browse_topstations(library):
results = library.browse('radionet:topstations')
assert len(results) > 0
def test_browse_genres(library):
results = library.browse('radionet:genres')
assert len(results) > 0
genres = library.browse('radionet:genres')
assert len(genres) > 0
cat_uri = results[0].uri if results is not None else None
cat_uri = genres[0].uri if genres is not None else None
assert cat_uri is not None
results = library.browse(cat_uri)
assert len(results) == 2
pages = library.browse(cat_uri)
assert len(pages) == 7
sort_uri = results[0].uri if results is not None else None
assert sort_uri is not None
page_uri = pages[0].uri if pages is not None else None
assert page_uri is not None
results = library.browse(sort_uri)
results = library.browse(page_uri)
assert len(results) > 0
page_uri = results[0].uri if results is not None else None
page_uri = pages[len(pages) - 1].uri if results is not None else None
assert page_uri is not None
results = library.browse(page_uri)
@@ -47,19 +40,13 @@ def test_browse_genres(library):
def test_browse_topics(library):
results = library.browse('radionet:topics')
assert len(results) > 0
assert len(results) > 2
cat_uri = results[0].uri if results is not None else None
cat_uri = results[2].uri if results is not None else None
assert cat_uri is not None
results = library.browse(cat_uri)
assert len(results) == 2
sort_uri = results[0].uri if results is not None else None
assert sort_uri is not None
results = library.browse(sort_uri)
assert len(results) > 0
assert len(results) > 2
page_uri = results[0].uri if results is not None else None
assert page_uri is not None
@@ -77,13 +64,7 @@ def test_browse_languages(library):
assert cat_uri is not None
results = library.browse(cat_uri)
assert len(results) == 2
sort_uri = results[0].uri if results is not None else None
assert sort_uri is not None
results = library.browse(sort_uri)
assert len(results) > 0
assert len(results) == 11
page_uri = results[0].uri if results is not None else None
assert page_uri is not None
@@ -103,12 +84,6 @@ def test_browse_cities(library):
results = library.browse(cat_uri)
assert len(results) == 2
sort_uri = results[0].uri if results is not None else None
assert sort_uri is not None
results = library.browse(sort_uri)
assert len(results) > 0
page_uri = results[0].uri if results is not None else None
assert page_uri is not None
@@ -125,13 +100,7 @@ def test_browse_countries(library):
assert cat_uri is not None
results = library.browse(cat_uri)
assert len(results) == 2
sort_uri = results[0].uri if results is not None else None
assert sort_uri is not None
results = library.browse(sort_uri)
assert len(results) > 0
assert len(results) == 4
page_uri = results[0].uri if results is not None else None
assert page_uri is not None
@@ -147,13 +116,13 @@ def test_browse_favorites(library):
def test_search(library):
result = library.search({'any': ['radio ram']})
result = library.search({'any': ['katze']})
assert len(result.tracks) > 0
old_length = len(result.tracks)
result = library.search({'any': ['radio ram']})
result = library.search({'any': ['katze']})
assert len(result.tracks) == old_length
@@ -169,4 +138,4 @@ def test_lookup(library):
def test_track_by_slug(library):
results = library.lookup('radionet:track:dancefm')
assert 1 == len(results)
assert results[0].uri == 'radionet:track:2180'
assert results[0].uri == 'radionet:track:dancefm'