Fix get_history (#691)

* fix get_history feedbackToken parsing

* remove broken playlist test

* skip broken tests for now
This commit is contained in:
sigma67 2024-12-17 12:21:04 +01:00 • committed by GitHub
commit 7ef703c213
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 12 additions and 4 deletions

View file

@ -63,6 +63,7 @@ class TestOAuth:
oauth_file.close()
Path(oauth_file.name).unlink()
@pytest.mark.skip(reason="this test needs to be fixed with the oauth update")
def test_oauth_tokens(self, oauth_filepath: str, yt_oauth: YTMusic):
# ensure instance initialized token
assert yt_oauth._token is not None

View file

@ -93,6 +93,7 @@ class TestLibrary:
def test_get_history(self, yt_oauth):
songs = yt_oauth.get_history()
assert len(songs) > 0
assert all(song["feedbackToken"] is not None for song in songs)
def test_manipulate_history_items(self, yt_auth, sample_video):
song = yt_auth.get_song(sample_video)
@ -113,9 +114,10 @@ class TestLibrary:
response = yt_auth.rate_song(sample_video, "notexist")
assert not response
@pytest.mark.skip(reason="edit_song_library_status is currently broken due to server-side update")
def test_edit_song_library_status(self, yt_brand, sample_album):
album = yt_brand.get_album(sample_album)
response = yt_brand.edit_song_library_status(album["tracks"][0]["feedbackTokens"]["add"])
response = yt_brand.rate_playlist(album["tracks"][0]["feedbackTokens"]["add"])
album = yt_brand.get_album(sample_album)
assert album["tracks"][0]["inLibrary"]
assert response["feedbackResponses"][0]["isProcessed"]

View file

@ -48,7 +48,6 @@ class TestPlaylists:
("RDCLAK5uy_nfjzC9YC1NVPPZHvdoAtKVBOILMDOuxOs", 200, 10),
("PLj4BSJLnVpNyIjbCWXWNAmybc97FXLlTk", 200, 0), # no related tracks
("PL6bPxvf5dW5clc3y9wAoslzqUrmkZ5c-u", 1000, 10), # very large
("PLZ6Ih9wLHQ2Hm2d3Cb0iV48Z2hQjGRyNz", 300, 10), # runs in subtitle, not title
("PL5ZNf-B8WWSZFIvpJWRjgt7iRqWT7_KF1", 10, 10), # track duration > 1k hours
],
)