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_add_music_logged_out(self): logoutCurrentUser() music = add_music(title=TEST_MP3_SONG_TITLE, artist=TEST_MP3_ARTIST, link=TEST_MP3) self.assertEquals(None, music)