Ejemplo n.º 1
0
        self.assertEqual([(t.name, t.artist.name)
                          for t in list(api.search_track('baby')[:10])],
                         tracks)


apikey = "152a230561e72192b8b0f3e42362c6ff"
api = Api(apikey, no_cache=True)

data = {
    'name': 'Lithium',
    'mbid': '',
    'url': 'http://www.last.fm/music/Evanescence/_/Lithium',
    'duration': 223000,
    'streamable': True,
    'full_track': False,
    'artist': api.get_artist('Evanescence'),
    'album': api.get_album('The Open Door', 'Evanescence'),
    'position': 4,
    'image': {}
}
for k, v in data.iteritems():

    def testFunc(self):
        self.assertEqual(getattr(self.track, k), v)

    setattr(TestTrack,
            "testTrack%s" % k.replace('_', ' ').title().replace(' ', ''),
            testFunc)

test_suite = unittest.TestLoader().loadTestsFromTestCase(TestTrack)
Ejemplo n.º 2
0
                     ('Baby Fratelli', 'The Fratellis'),
                     ("I Can't Quit You Baby", 'Led Zeppelin'),
                     ('Baby Britain', 'Elliott Smith')]
        self.assertEqual([(t.name, t.artist.name) for t 
                          in list(api.search_track('baby')[:10])], tracks)

apikey = "152a230561e72192b8b0f3e42362c6ff"        
api = Api(apikey, no_cache = True)
        
data = {
    'name': 'Lithium',
    'mbid': '',
    'url': 'http://www.last.fm/music/Evanescence/_/Lithium',
    'duration': 223000,
    'streamable': True,
    'full_track': False,
    'artist': api.get_artist('Evanescence'),
    'album': api.get_album('The Open Door', 'Evanescence'),
    'position': 4,
    'image': {}
}
for k,v in data.items():
    def testFunc(self):
        self.assertEqual(getattr(self.track, k), v)
    setattr(TestTrack, "testTrack%s" % k.replace('_', ' ').title().replace(' ', ''), testFunc)
                
test_suite = unittest.TestLoader().loadTestsFromTestCase(TestTrack)

if __name__ == '__main__':
    unittest.main()
Ejemplo n.º 3
0
                 ('return to paradice', 'Nostalgia 77'),
                 ('return to paradice', 'Katalyst'),
                 ('return to paradice', 'Ennio Morricone'),
                 ('return to paradice', 'Cornucopia'),
                 ('return to paradice', 'Lost Balance')]
        self.assertEqual(
            [(album.name, album.artist.name) for album in api.search_album("paradice")[:10]],
            albums
        )

from apikey import api_key
api = Api(api_key, no_cache = True)

data = {
    'name': "Supersonic",
    'artist': api.get_artist("Oasis"),
    'id': 2038492,
    'mbid': '2c2a24de-67b6-483b-b597-9c6b7891ba90',
    'url': 'http://www.last.fm/music/Oasis/Supersonic',
    'release_date': datetime.datetime(1994, 7, 28, 0, 0),
    'image': {
              'extralarge': 'http://userserve-ak.last.fm/serve/300x300/23049597.jpg',
              'large': 'http://userserve-ak.last.fm/serve/174s/23049597.jpg',
              'medium': 'http://userserve-ak.last.fm/serve/64s/23049597.jpg',
              'small': 'http://userserve-ak.last.fm/serve/34s/23049597.jpg'
        }
}
        
for k,v in data.iteritems():
    def testFunc(self):
        self.assertEqual(getattr(self.album, k), v)