mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-11-30 21:15:18 +00:00
feat(music): list and select playlist songs by their position
This commit is contained in:
@@ -177,6 +177,20 @@ def test_list_tracks_stamps_the_service_flags(monkeypatch: pytest.MonkeyPatch, w
|
||||
assert all((t["anime"], t["daily"]) == (True, True) for t in titles)
|
||||
|
||||
|
||||
def test_list_tracks_selects_a_playlist_song_by_position(monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
songs = [
|
||||
Song(f"song-{album}", _FakeSvc, "Track", "Artist", album, track, disc, position=position)
|
||||
for album, track, disc, position in (("Z", 1, 1, 1), ("B", 6, 2, 2), ("A", 2, 1, 3))
|
||||
]
|
||||
monkeypatch.setattr(handlers, "validate_service", lambda tag, request=None: "FAKE")
|
||||
monkeypatch.setattr(handlers, "launch_served", lambda *a, **kw: handlers.Launched(_FakeService(songs), None, None))
|
||||
|
||||
response = asyncio.run(handlers.list_tracks_handler({"service": "FAKE", "title_id": "t1", "wanted": "2"}))
|
||||
|
||||
title = json.loads(response.body)["title"]
|
||||
assert (title["id"], title["position"], title["track"]) == ("song-B", 2, 6)
|
||||
|
||||
|
||||
def test_list_titles_stamps_the_service_flags(monkeypatch: pytest.MonkeyPatch) -> None:
|
||||
monkeypatch.setattr(handlers, "validate_service", lambda tag, request=None: "FAKE")
|
||||
monkeypatch.setattr(handlers, "launch_served", lambda *a, **kw: handlers.Launched(_FakeService([ep()]), None, None))
|
||||
|
||||
Reference in New Issue
Block a user