示例#1
0
 def test_get_top_artists_shortterm_exists(self):
     """
     If _top_artists['short_term'] is not None,
     top_artists('short_term') should return it.
     """
     u = UserData(None)
     test_data = ['hello', 'goodbye']
     u._top_artists['short_term'] = test_data
     self.assertEqual(u.top_artists('short_term'), test_data)
示例#2
0
 def test_compile_top_artists_shortterm(self):
     """
     _compile_top_tracks('short_term') should request data about the
     user's top tracks from Spotify and store it in the
     _top_tracks['short_term'] variable.
     """
     u = UserData(self.session)
     data = u.top_artists('short_term')
     self.assertGreaterEqual(len(data), 10)
     for a in data:
         self.assertEqual(a['type'], 'artist')
示例#3
0
 def test_compile_top_artists_longterm(self):
     """
     _compile_top_artists('long_term') should request data about the
     user's top artists from Spotify and store it in the 
     _top_artists['long_term'] variable.
     """
     u = UserData(self.session)
     data = u.top_artists('long_term')
     self.assertEqual(len(data), 50)
     for a in data:
         self.assertEqual(a['type'], 'artist')