Resolve "Pagination of results in genres in Subsonic API does not work"

This commit is contained in:
Eliot Berriot 2019-10-28 08:58:32 +01:00
commit 69795b5ca2
3 changed files with 25 additions and 1 deletions

View file

@ -520,6 +520,23 @@ def test_get_songs_by_genre(f, tags_field, db, logged_in_api_client, factories):
assert response.data == expected
def test_get_songs_by_genre_offset(logged_in_api_client, factories):
url = reverse("api:subsonic-get_songs_by_genre")
assert url.endswith("getSongsByGenre") is True
track1 = factories["music.Track"](playable=True, set_tags=["Rock"])
factories["music.Track"](playable=True, set_tags=["Rock"])
factories["music.Track"](playable=True, set_tags=["Pop"])
# the API order tracks by creation date DESC, so the second one
# returned by the API is the first one to be created in the test.
expected = {"songsByGenre": {"song": serializers.get_song_list_data([track1])}}
response = logged_in_api_client.get(
url, {"f": "json", "count": 1, "offset": 1, "genre": "rock"}
)
assert response.status_code == 200
assert response.data == expected
@pytest.mark.parametrize("f", ["json"])
def test_search3(f, db, logged_in_api_client, factories):
url = reverse("api:subsonic-search3")