Example #1
0
 def test_get_music_taste_with_audio_features_exists(self):
     """
     If _music_taste has audio features in its data,
     music_taste_with_audio_features() should return it.
     """
     u = UserData(None)
     test_data = [{'id': 5, 'energy': 0}, {'id': 2, 'energy': 5}]
     u._music_taste = test_data
     self.assertEqual(u.music_taste_with_audio_features(), test_data)
Example #2
0
 def test_compile_audio_features(self):
     """
     _compile_audio_features() should request data about audio
     features of the user's music taste from Spotify and store it in
     the _music_taste variable.
     """
     u = UserData(self.session)
     data = u.music_taste_with_audio_features()
     self.assertGreaterEqual(len(data), 50)
     for t in data:
         self.assertEqual(t['type'], 'track')
         self.assertIsNotNone(t.get('energy'))
         self.assertIsNotNone(t.get('danceability'))
         self.assertIsNotNone(t.get('valence'))