@@ -1499,6 +1499,47 @@ async def test_save_too_many_audiobooks(
14991499 responses .assert_not_called () # type: ignore[no-untyped-call]
15001500
15011501
1502+ async def test_remove_audiobooks (
1503+ responses : aioresponses ,
1504+ authenticated_client : SpotifyClient ,
1505+ ) -> None :
1506+ """Test removing an audiobook."""
1507+ responses .delete (
1508+ f"{ SPOTIFY_URL } /v1/me/audiobooks?ids=0TnOYISbd1XYRBk9myaseg" ,
1509+ status = 200 ,
1510+ body = "" ,
1511+ )
1512+ await authenticated_client .remove_saved_audiobooks (["0TnOYISbd1XYRBk9myaseg" ])
1513+ responses .assert_called_once_with (
1514+ f"{ SPOTIFY_URL } /v1/me/audiobooks" ,
1515+ METH_DELETE ,
1516+ headers = HEADERS ,
1517+ params = {"ids" : "0TnOYISbd1XYRBk9myaseg" },
1518+ json = None ,
1519+ )
1520+
1521+
1522+ async def test_remove_no_audiobooks (
1523+ responses : aioresponses ,
1524+ authenticated_client : SpotifyClient ,
1525+ ) -> None :
1526+ """Test removing no audiobooks."""
1527+ await authenticated_client .remove_saved_audiobooks ([])
1528+ responses .assert_not_called () # type: ignore[no-untyped-call]
1529+
1530+
1531+ async def test_remove_too_many_audiobooks (
1532+ responses : aioresponses ,
1533+ authenticated_client : SpotifyClient ,
1534+ ) -> None :
1535+ """Test removing too many audiobooks."""
1536+ with pytest .raises (
1537+ ValueError , match = "Maximum of 50 audiobooks can be removed at once"
1538+ ):
1539+ await authenticated_client .remove_saved_audiobooks (["abc" ] * 51 )
1540+ responses .assert_not_called () # type: ignore[no-untyped-call]
1541+
1542+
15021543async def test_get_show_episodes (
15031544 responses : aioresponses ,
15041545 snapshot : SnapshotAssertion ,
0 commit comments