def test_get_top_tracks_shortterm_exists(self): """ If _top_tracks['short_term'] is not None, top_tracks('short_term') should return it. """ u = UserData(None) test_data = ['hello', 'goodbye'] u._top_tracks['short_term'] = test_data self.assertEqual(u.top_tracks('short_term'), test_data)
def test_compile_top_tracks_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_tracks('short_term') self.assertGreaterEqual(len(data), 10) for t in data: self.assertEqual(t['type'], 'track')