tests for tracks in collaborative playlists
This commit is contained in:
parent
40ff2b42a7
commit
895ebb0898
3 changed files with 21 additions and 2 deletions
1
tests/data/2024_07_get_playlist_collaborative.json
Normal file
1
tests/data/2024_07_get_playlist_collaborative.json
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -85,6 +85,12 @@ class TestBrowsing:
|
|||
assert len(album["tracks"]) == 19
|
||||
assert len(album["artists"]) == 1
|
||||
assert len(album) == 14
|
||||
for track in album["tracks"]:
|
||||
assert isinstance(track["title"], str) and track["title"]
|
||||
assert len(track["artists"]) > 0
|
||||
for artist in track["artists"]:
|
||||
assert "name" in artist
|
||||
assert isinstance(artist["name"], str) and artist["name"]
|
||||
|
||||
def test_get_album(self, yt, yt_auth, sample_album):
|
||||
album = yt_auth.get_album(sample_album)
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ class TestPlaylists:
|
|||
[
|
||||
("2024_03_get_playlist.json", True),
|
||||
("2024_03_get_playlist_public.json", False),
|
||||
("2024_07_get_playlist_collaborative.json", True),
|
||||
],
|
||||
)
|
||||
def test_get_playlist_2024(self, yt, test_file, owned):
|
||||
|
|
@ -25,9 +26,20 @@ class TestPlaylists:
|
|||
playlist = yt.get_playlist("MPREabc")
|
||||
assert playlist["year"] == "2024"
|
||||
assert playlist["owned"] == owned
|
||||
assert "hours" in playlist["duration"]
|
||||
assert "hours" in playlist["duration"] or "minutes" in playlist["duration"]
|
||||
assert playlist["id"]
|
||||
assert isinstance(playlist["description"], str)
|
||||
assert isinstance(playlist["description"], str) and playlist["description"]
|
||||
assert len(playlist["tracks"]) > 0
|
||||
|
||||
for track in playlist["tracks"]:
|
||||
assert isinstance(track["title"], str) and track["title"]
|
||||
|
||||
assert len(track["artists"]) > 0
|
||||
for artist in track["artists"]:
|
||||
assert isinstance(artist["name"], str) and artist["name"]
|
||||
|
||||
if track["videoType"] == "MUSIC_VIDEO_TYPE_ATV":
|
||||
assert isinstance(track["album"]["name"], str) and track["album"]["name"]
|
||||
|
||||
def test_get_playlist_foreign(self, yt, yt_auth, yt_oauth):
|
||||
with pytest.raises(Exception):
|
||||
|
|
|
|||
Loading…
Reference in a new issue