feat: implement user audiobook endpoints

This commit is contained in:
soumitradev committed 2025-08-15 21:16:08 +00:00
1 parent a91d9feb51
commit 0835b60486
2 files changed
+49

No files matched your search

+18
View File
@@ -221,6 +221,11 @@ class SpotipyLibraryApiTests(unittest.TestCase):
"spotify:episode:3OEdPEYB69pfXoBrhvQYeC",
"spotify:episode:5LEFdZ9pYh99wSz7Go2D0g"
]
cls.audiobook_ids = [
"spotify:audiobook:7iHfbu1YPACw6oZPAFJtqe",
"spotify:audiobook:1HGw3J3NxZO1TP1BTtVhpZ",
"spotify:audiobook:7iHfbu1YPACw6oZPAFJtqe"
]
cls.username = os.getenv(CCEV['client_username'])
scope = (
@@ -248,6 +253,19 @@ class SpotipyLibraryApiTests(unittest.TestCase):
tracks = self.spotify.current_user_saved_tracks()
self.assertGreaterEqual(len(tracks['items']), 0)
def test_current_user_saved_audiobooks(self):
audiobooks = self.spotify.current_user_saved_audiobooks()
total = audiobooks['total']
self.spotify.current_user_saved_audiobooks_add(self.audiobook_ids)
new_audiobooks = self.spotify.current_user_saved_audiobooks()
new_total = new_audiobooks['total']
self.assertEqual(new_total - total, len(self.audiobook_ids))
self.spotify.current_user_saved_audiobooks_delete(self.audiobook_ids)
new_audiobooks = self.spotify.current_user_saved_audiobooks()
new_total = new_audiobooks['total']
def test_current_user_save_tracks(self):
tracks = self.spotify.current_user_saved_tracks()
total = tracks['total']