Really add library.removeArtist, closes #84

This commit is contained in:
hugovk 2014-03-02 00:04:30 +02:00
parent bdb429cc8a
commit 3e5e371b29
2 changed files with 31 additions and 0 deletions

View file

@ -2039,6 +2039,17 @@ class Library(_BaseObject):
self._request("library.addArtist", False, params)
def remove_artist(self, artist):
"""Remove an artist from this library."""
params = self._get_params()
if type(artist) == str:
params["artist"] = artist
else:
params["artist"] = artist.get_name()
self._request("library.removeArtist", False, params)
def add_track(self, track):
"""Add a track to this library."""

View file

@ -121,6 +121,25 @@ class TestPyLast(unittest.TestCase):
self.assertTrue(value)
def test_remove_artist(self):
# Arrange
artist = "Test Artist 2"
library = pylast.Library(user = self.username, network = self.network)
library.add_artist(artist)
# Act
library.remove_artist(artist)
# Assert
artists = library.get_artists()
for artist in artists:
value = (str(artist[0]) == "Test Artist 2")
if value:
break
self.assertFalse(value)
def test_get_venue(self):
# Arrange
venue_name = "Last.fm Office"
country_name = "United Kingom"
@ -305,6 +324,7 @@ if __name__ == '__main__':
# suite = unittest.TestSuite()
# suite.addTest(TestPyLast('test_add_artist'))
# suite.addTest(TestPyLast('test_remove_artist'))
# unittest.TextTestRunner().run(suite)
unittest.main()