2008-09-16 21:08:01 +05:30
|
|
|
import unittest
|
|
|
|
import datetime
|
2008-09-16 21:19:30 +05:30
|
|
|
import sys
|
|
|
|
sys.path.append("..")
|
|
|
|
|
|
|
|
from src import Api
|
2008-09-16 21:08:01 +05:30
|
|
|
|
|
|
|
apikey = "152a230561e72192b8b0f3e42362c6ff"
|
|
|
|
|
2008-09-16 21:19:30 +05:30
|
|
|
class TestAlbum(unittest.TestCase):
|
2008-09-16 21:08:01 +05:30
|
|
|
""" A test class for the Album module. """
|
|
|
|
|
|
|
|
def setUp(self):
|
2008-09-16 21:19:30 +05:30
|
|
|
self.api_test = Api(apikey)
|
2008-09-16 21:08:01 +05:30
|
|
|
self.album_test = self.api_test.getAlbum("Oasis", "Supersonic")
|
|
|
|
|
|
|
|
def testAlbumName(self):
|
|
|
|
self.assertEqual(self.album_test.name, "Supersonic")
|
|
|
|
|
|
|
|
def testAlbumArtist(self):
|
|
|
|
self.assertEqual(self.album_test.artist.name, "Oasis")
|
|
|
|
|
|
|
|
def testAlbumUrl(self):
|
|
|
|
url = 'http://www.last.fm/music/Oasis/Supersonic'
|
|
|
|
self.assertEqual(self.album_test.url, url)
|
|
|
|
|
|
|
|
def testAlbumReleaseDate(self):
|
|
|
|
date = datetime.datetime(1994, 7, 28, 0, 0)
|
|
|
|
self.assertEqual(self.album_test.releaseDate, date)
|
|
|
|
|
|
|
|
def testAlbumMbid(self):
|
|
|
|
mbid = '2c2a24de-67b6-483b-b597-9c6b7891ba90'
|
|
|
|
self.assertEqual(self.album_test.mbid, mbid)
|
|
|
|
|
|
|
|
def testAlbumId(self):
|
|
|
|
id = 2038492
|
|
|
|
self.assertEqual(self.album_test.id, id)
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
unittest.main()
|