parent
d63eb07779
commit
2217f3d92d
7 changed files with 64 additions and 8 deletions
1
tests/data/2024_03_get_album.json
Normal file
1
tests/data/2024_03_get_album.json
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -1,4 +1,7 @@
|
|||
import json
|
||||
import warnings
|
||||
from pathlib import Path
|
||||
from unittest import mock
|
||||
|
||||
import pytest
|
||||
|
||||
|
|
@ -74,6 +77,15 @@ class TestBrowsing:
|
|||
escaped_browse_id = yt.get_album_browse_id("OLAK5uy_nbMYyrfeg5ZgknoOsOGBL268hGxtcbnDM")
|
||||
assert escaped_browse_id == "MPREb_scJdtUCpPE2"
|
||||
|
||||
def test_get_album_2024(self, yt):
|
||||
with open(Path(__file__).parent.parent / "data" / "2024_03_get_album.json", encoding="utf8") as f:
|
||||
mock_response = json.load(f)
|
||||
with mock.patch("ytmusicapi.YTMusic._send_request", return_value=mock_response):
|
||||
album = yt.get_album("MPREabc")
|
||||
assert len(album["tracks"]) == 19
|
||||
assert len(album["artists"]) == 1
|
||||
assert len(album) == 13
|
||||
|
||||
def test_get_album(self, yt, yt_auth, sample_album):
|
||||
album = yt_auth.get_album(sample_album)
|
||||
assert len(album) >= 9
|
||||
|
|
|
|||
Loading…
Reference in a new issue