2 # runs tons of test queries against the API,
3 # sleeping between each and printing the result
5 # debugging hack - add . to path
7 local_module_dir = os.path.join(os.path.dirname(sys.argv[0]), '..')
8 if os.path.isdir(local_module_dir):
9 sys.path.append(os.path.abspath(local_module_dir))
13 import jamaendo.api2 as api2
16 def XXXtestSearchArtists(self):
17 result = api2.search_artists('porn')
18 print "Result:", result
19 print "Cache:", api2._artists
21 def XXXtestSearchAlbums(self):
22 result = api2.search_albums('porn')
23 print "Result:", result
24 print "Cache:", api2._albums
26 def XXXtestSearchTracks(self):
27 result = api2.search_tracks('porn')
28 print "Result:", result
29 print "Cache:", api2._tracks
31 def XXXtestAlbumsOfTheWeek(self):
32 result = api2.albums_of_the_week()
33 print "Result:", result
34 print "Cache:", api2._albums
36 def XXXtestNewReleases(self):
37 result = api2.new_releases()
38 print "Result:", result
39 print "Cache:", api2._tracks
41 def XXXtestTracksOfTheWeek(self):
42 result = api2.tracks_of_the_week()
43 print "Result:", result
44 print "Cache:", api2._tracks
46 def XXXtestStarredRadios(self):
47 result = api2.starred_radios()
48 print "Result:", result
50 def XXXtestGetRadio283(self):
51 result = api2.get_radio(283)
52 print "Result:", result
54 def XXXtestGetArtist91(self):
55 result = api2.get_artist(91)
56 print "Result:", result
58 def XXXtestGetAlbum27865(self):
59 result = api2.get_album(27865)
60 print "Result:", result
62 def XXXtestGetTrack353341(self):
63 result = api2.get_track(353341)
64 print "Result:", result
66 def XXXtestGetTracks27865(self):
67 result = api2.get_tracks(27865)
68 print "Result:", result
70 def XXXtestGetAlbums91(self):
71 result = api2.get_albums(91)
72 print "Result:", result
74 def testGetAlbumCover27865(self):
75 result = api2.get_album_cover(27865)
76 print "Result:", result
78 def testGetAlbumCoverAsync27865(self):
79 self.got_cover = False
83 api2.get_album_cover_async(gotit, 27865)
84 while not self.got_cover:
85 print "Waiting for cover..."
91 for name in Tests.__dict__.keys():
92 if name.startswith('test'):
93 print "Running %s" % (name)
102 if __name__=="__main__":