Example #1
0
 def test_get_top_tracks_limit(self):
     "Only returns the number of top tracks requested"
     artist = ArtistFactory()
     tracks = TrackFactory.create_batch(4, artist=artist)
     for t in tracks:
         ScrobbleFactory(artist=artist, track=t)
     top_tracks = artist.get_top_tracks(limit=3)
     self.assertEqual(len(top_tracks), 3)
Example #2
0
 def test_get_top_tracks(self):
     "Returns all tracks, ordered by most-scrobbled first"
     artist = ArtistFactory()
     tracks = TrackFactory.create_batch(3, artist=artist)
     # Scrobble all tracks once...
     for t in tracks:
         ScrobbleFactory(artist=artist, track=t)
     # ... but scrobble one of them an additional time:
     ScrobbleFactory(artist=artist, track=tracks[1])
     top_tracks = artist.get_top_tracks()
     self.assertEqual(len(top_tracks), 3)
     self.assertEqual(top_tracks[0], tracks[1])