| @@ 130-150 (lines=21) @@ | ||
| 127 | break |
|
| 128 | self.assertTrue(value) |
|
| 129 | ||
| 130 | @handle_lastfm_exceptions |
|
| 131 | def test_remove_album(self): |
|
| 132 | # Arrange |
|
| 133 | library = pylast.Library(user=self.username, network=self.network) |
|
| 134 | # Pick an artist with plenty of albums |
|
| 135 | artist = self.network.get_top_artists(limit=1)[0].item |
|
| 136 | albums = artist.get_top_albums() |
|
| 137 | # Pick a random one to avoid problems running concurrent tests |
|
| 138 | album = choice(albums)[0] |
|
| 139 | library.add_album(album) |
|
| 140 | ||
| 141 | # Act |
|
| 142 | library.remove_album(album) |
|
| 143 | ||
| 144 | # Assert |
|
| 145 | my_albums = library.get_albums() |
|
| 146 | for my_album in my_albums: |
|
| 147 | value = (album == my_album[0]) |
|
| 148 | if value: |
|
| 149 | break |
|
| 150 | self.assertFalse(value) |
|
| 151 | ||
| 152 | @handle_lastfm_exceptions |
|
| 153 | def test_add_artist(self): |
|
| @@ 169-188 (lines=20) @@ | ||
| 166 | break |
|
| 167 | self.assertTrue(value) |
|
| 168 | ||
| 169 | @handle_lastfm_exceptions |
|
| 170 | def test_remove_artist(self): |
|
| 171 | # Arrange |
|
| 172 | # Get plenty of artists |
|
| 173 | artists = self.network.get_top_artists() |
|
| 174 | # Pick a random one to avoid problems running concurrent tests |
|
| 175 | my_artist = choice(artists).item |
|
| 176 | library = pylast.Library(user=self.username, network=self.network) |
|
| 177 | library.add_artist(my_artist) |
|
| 178 | ||
| 179 | # Act |
|
| 180 | library.remove_artist(my_artist) |
|
| 181 | ||
| 182 | # Assert |
|
| 183 | artists = library.get_artists() |
|
| 184 | for artist in artists: |
|
| 185 | value = (artist[0] == my_artist) |
|
| 186 | if value: |
|
| 187 | break |
|
| 188 | self.assertFalse(value) |
|
| 189 | ||
| 190 | @handle_lastfm_exceptions |
|
| 191 | def test_get_venue(self): |
|