#!/usr/bin/env python __author__ = "Abhinav Sarkar " __version__ = "0.2" __license__ = "GNU Lesser General Public License" import unittest import sys, os from wsgi_intercept.urllib2_intercept import install_opener import wsgi_intercept from wsgi_test_app import create_wsgi_app install_opener() wsgi_intercept.add_wsgi_intercept('ws.audioscrobbler.com', 80, create_wsgi_app) sys.path.append(os.path.dirname(os.path.dirname(__file__))) from lastfm import Api class TestPlaylist(unittest.TestCase): """ A test class for the Geo module. """ def setUp(self): apikey = "152a230561e72192b8b0f3e42362c6ff" self.api = Api(apikey, no_cache = True) self.playlist = self.api.get_playlist('lastfm://playlist/album/2287667') def tearDown(self): pass def testPlaylistUrl(self): self.assertEqual(self.playlist.url, 'lastfm://playlist/album/2287667') # def testPlaylistData(self): # data = """ # # #Bon Jovi - Have a Nice Day #Previews for Bon Jovi - Have a Nice Day #http://www.last.fm/music/Bon+Jovi/Have+a+Nice+Day #2009-03-04T09:49:28 # # # Have a Nice Day # http://www.last.fm/music/Bon+Jovi/_/Have+a+Nice+Day # Have a Nice Day # Bon Jovi # 228000 # http://www.last.fm/music/Bon+Jovi/_/Have+a+Nice+Day # http://userserve-ak.last.fm/serve/126/8750501.jpg # # # #""" # self.assertEqual(self.playlist.data, data) test_suite = unittest.TestLoader().loadTestsFromTestCase(TestPlaylist) if __name__ == '__main__': unittest.main()