def test_convert_top_artists_none(self): """Check we deal with a user without any top artists.""" json_file = open(self.path + "/test_data/top_artists_none.json", "r") recent_tracks = json_file.read() json_file.close() service_items = _convert_top_artists_json("username", "lastfm", simplejson.loads(recent_tracks)) self.assertEqual(len(service_items), 0)
def test_convert_top_artists(self): """Check we can convert the top_artists json without issue.""" json_file = open(self.path + "/test_data/top_artists.json", "r") recent_tracks = json_file.read() json_file.close() service_items = _convert_top_artists_json("username", "lastfm", simplejson.loads(recent_tracks)) self.assertEqual(len(service_items), 50)