Add support for new user.getTrackScrobbles

This commit is contained in:
Hugo 2019-02-27 19:47:31 +02:00
parent dc464788f2
commit da473448f4
2 changed files with 54 additions and 0 deletions

View file

@ -433,6 +433,34 @@ class TestPyLastUser(TestPyLastWithLastFm):
self.assertIsNotNone(track)
self.assertIsInstance(track.network, pylast.LastFMNetwork)
def test_user_get_track_scrobbles(self):
# Arrange
artist = "France Gall"
title = "Laisse Tomber Les Filles"
user = self.network.get_user("bbc6music")
# Act
scrobbles = user.get_track_scrobbles(artist, title)
# Assert
self.assertGreater(len(scrobbles), 0)
self.assertEqual(str(scrobbles[0].track.artist), "France Gall")
self.assertEqual(scrobbles[0].track.title, "Laisse Tomber Les Filles")
def test_cacheable_user_get_track_scrobbles(self):
# Arrange
artist = "France Gall"
title = "Laisse Tomber Les Filles"
user = self.network.get_user("bbc6music")
# Act
result1 = user.get_track_scrobbles(artist, title, cacheable=False)
result2 = user.get_track_scrobbles(artist, title, cacheable=True)
result3 = user.get_track_scrobbles(artist, title)
# Assert
self.helper_validate_results(result1, result2, result3)
if __name__ == "__main__":
unittest.main(failfast=True)