def test_add_music_no_problem(self): EMAIL = '*****@*****.**' NAME = 'akiva' setCurrentUser(EMAIL, NAME) music = add_music(title=TEST_MP3_SONG_TITLE, artist=TEST_MP3_ARTIST, link=TEST_MP3) self.assertEquals(music.user.name, NAME) self.assertEquals(music.title, TEST_MP3_SONG_TITLE) self.assertEquals(music.artist, TEST_MP3_ARTIST) if music.data: self.assertEquals(music.data.link, TEST_MP3) self.assertEquals(music.image.link, get_cover_art_link(TEST_MP3_SONG_TITLE, TEST_MP3_ARTIST))
def test_add_music_bad_link(self): EMAIL = '*****@*****.**' NAME = 'akiva' setCurrentUser(EMAIL, NAME) LINK = 'nothing' music = add_music(title=TEST_MP3_SONG_TITLE, artist=TEST_MP3_ARTIST, link=LINK) self.assertEquals(music.user.name, NAME) self.assertEquals(music.title, TEST_MP3_SONG_TITLE) self.assertEquals(music.artist, TEST_MP3_ARTIST) self.assertEquals(music.data.hash, 'music_without_data') self.assertEquals(music.image.link, get_cover_art_link(TEST_MP3_SONG_TITLE, TEST_MP3_ARTIST)) img = images.Image(music.image.data) self.assertEquals(img.width, 200)
def test_get_cover_art(self): art = get_cover_art_link(TEST_MP3_SONG_TITLE, TEST_MP3_ARTIST) self.assertEquals(art, 'http://userserve-ak.last.fm/serve/_/45807281/David+Guetta+png.png')