Exemplo n.º 1
0
 def test_multiple_mixed_artists(self):
     mixed_artist_responses = [{
         'response': {
             'status': {
                 'code': 5,
                 'message': 'The Identifier specified does not exist',
                 'version': '4.2'
             }
         }
     }, {
         'response': {
             'status': {
                 'code': 0,
                 'message': 'Success',
                 'version': '4.2'
             },
             'artist': {
                 'familiarity': 0.908821,
                 'hotttnesss': 0.804396,
                 'name': 'The Beatles',
                 'id': 'AR6XZ861187FB4CECD'
             }
         }
     }]
     self.assertEqual(main.format_artist_profiles(mixed_artist_responses),
                      [{
                          'familiarity': 0.908821,
                          'hotttnesss': 0.804396,
                          'name': 'The Beatles',
                          'id': 'AR6XZ861187FB4CECD'
                      }])
Exemplo n.º 2
0
 def test_single_invalid_artist(self):
     invalid_artist_response = [{
         'response': {
             'status': {
                 'code': 5,
                 'message': 'The Identifier specified does not exist',
                 'version': '4.2'
             }
         }
     }]
     self.assertEqual(main.format_artist_profiles(invalid_artist_response),
                      [])
Exemplo n.º 3
0
 def test_multiple_valid_artists(self):
     valid_artist_responses = [{
         'response': {
             'status': {
                 'code': 0,
                 'message': 'Success',
                 'version': '4.2'
             },
             'artist': {
                 'familiarity': 0.908821,
                 'hotttnesss': 0.804396,
                 'name': 'The Beatles',
                 'id': 'AR6XZ861187FB4CECD'
             }
         }
     }, {
         'response': {
             'status': {
                 'code': 0,
                 'message': 'Success',
                 'version': '4.2'
             },
             'artist': {
                 'familiarity': 0.858889,
                 'hotttnesss': 0.797314,
                 'name': 'Pink Floyd',
                 'id': 'ARD4C1I1187FB4B0C3'
             }
         }
     }]
     self.assertEqual(main.format_artist_profiles(valid_artist_responses),
                      [{
                          'familiarity': 0.908821,
                          'hotttnesss': 0.804396,
                          'name': 'The Beatles',
                          'id': 'AR6XZ861187FB4CECD'
                      }, {
                          'familiarity': 0.858889,
                          'hotttnesss': 0.797314,
                          'name': 'Pink Floyd',
                          'id': 'ARD4C1I1187FB4B0C3'
                      }])
Exemplo n.º 4
0
 def test_single_valid_artist(self):
     valid_artist_response = [{
         'response': {
             'status': {
                 'code': 0,
                 'message': 'Success',
                 'version': '4.2'
             },
             'artist': {
                 'familiarity': 0.908821,
                 'hotttnesss': 0.804396,
                 'name': 'The Beatles',
                 'id': 'AR6XZ861187FB4CECD'
             }
         }
     }]
     self.assertEqual(main.format_artist_profiles(valid_artist_response),
                      [{
                          'familiarity': 0.908821,
                          'hotttnesss': 0.804396,
                          'name': 'The Beatles',
                          'id': 'AR6XZ861187FB4CECD'
                      }])
Exemplo n.º 5
0
 def test_no_artists(self):
     self.assertEqual(main.format_artist_profiles([]), [])
Exemplo n.º 6
0
 def test_single_valid_artist(self):
     valid_artist_response = [{'response': {'status': {'code': 0, 'message': 'Success', 'version': '4.2'}, 'artist': {'familiarity': 0.908821, 'hotttnesss': 0.804396, 'name': 'The Beatles', 'id': 'AR6XZ861187FB4CECD'}}}]
     self.assertEqual(main.format_artist_profiles(valid_artist_response),
                      [{'familiarity': 0.908821, 'hotttnesss': 0.804396, 'name': 'The Beatles', 'id': 'AR6XZ861187FB4CECD'}])
Exemplo n.º 7
0
 def test_no_artists(self):
     self.assertEqual(main.format_artist_profiles([]), [])
Exemplo n.º 8
0
 def test_multiple_mixed_artists(self):
     mixed_artist_responses = [{'response': {'status': {'code': 5, 'message': 'The Identifier specified does not exist', 'version': '4.2'}}},
                               {'response': {'status': {'code': 0, 'message': 'Success', 'version': '4.2'}, 'artist': {'familiarity': 0.908821, 'hotttnesss': 0.804396, 'name': 'The Beatles', 'id': 'AR6XZ861187FB4CECD'}}}]
     self.assertEqual(main.format_artist_profiles(mixed_artist_responses),
                      [{'familiarity': 0.908821, 'hotttnesss': 0.804396, 'name': 'The Beatles', 'id': 'AR6XZ861187FB4CECD'}])
Exemplo n.º 9
0
 def test_multiple_invalid_artists(self):
     invalid_artist_responses = [{'response': {'status': {'code': 5, 'message': 'The Identifier specified does not exist', 'version': '4.2'}}},
                                 {'response': {'status': {'code': 5, 'message': 'The Identifier specified does not exist', 'version': '4.2'}}}]
     self.assertEqual(main.format_artist_profiles(invalid_artist_responses), [])
Exemplo n.º 10
0
 def test_multiple_valid_artists(self):
     valid_artist_responses = [{'response': {'status': {'code': 0, 'message': 'Success', 'version': '4.2'}, 'artist': {'familiarity': 0.908821, 'hotttnesss': 0.804396, 'name': 'The Beatles', 'id': 'AR6XZ861187FB4CECD'}}},
                               {'response': {'status': {'code': 0, 'message': 'Success', 'version': '4.2'}, 'artist': {'familiarity': 0.858889, 'hotttnesss': 0.797314, 'name': 'Pink Floyd', 'id': 'ARD4C1I1187FB4B0C3'}}}]
     self.assertEqual(main.format_artist_profiles(valid_artist_responses),
                      [{'familiarity': 0.908821, 'hotttnesss': 0.804396, 'name': 'The Beatles', 'id': 'AR6XZ861187FB4CECD'}, {'familiarity': 0.858889, 'hotttnesss': 0.797314, 'name': 'Pink Floyd', 'id': 'ARD4C1I1187FB4B0C3'}])