def test_delete(self): playlist = Playlist(name="DELETE - Unit Test Videos", type=PlaylistTypeEnum.EXPLICIT) for video in Video.find_by_tags(and_tags=["unittest"]): playlist.videos.append(video) playlist.save() playlist.delete() self.assertEquals(playlist.id, None)
def test_save_new(self): playlist = Playlist(name="Unit Test Videos", type=PlaylistTypeEnum.EXPLICIT) for video in Video.find_by_tags(and_tags=['unittest', ]): playlist.videos.append(video) playlist.save() self.assertEquals(playlist.id > 0, True)
def test_instantiate_new(self): playlist = Playlist(name="My Playlist", type=PlaylistTypeEnum.EXPLICIT) playlist.video_ids = TEST_VIDEO_IDS self.assertEquals(playlist.id, None) self.assertEquals(playlist.name, "My Playlist") self.assertEquals(playlist.type, PlaylistTypeEnum.EXPLICIT) self.assertEquals(playlist.video_ids, TEST_VIDEO_IDS) self.assertEquals(playlist.short_description, None)
def test_find_for_player_id(self): playlists = Playlist.find_for_player_id(23424255) for playlist in playlists: self.assertEquals(type(playlist), Playlist)
def test_find_by_reference_ids(self): playlists = Playlist.find_by_reference_ids(TEST_PLAYLIST_REF_IDS) for playlist in playlists: self.assertEquals(type(playlist), Playlist) self.assertEquals(playlist.reference_id in TEST_PLAYLIST_REF_IDS, True)
def test_save_update(self): playlist = Playlist(id=TEST_PLAYLIST_ID) playlist.name = "test-%s" % self.test_uuid playlist.save() self.assertEquals(playlist.name, "test-%s" % self.test_uuid)
def test_find_all(self): playlists = Playlist.find_all() for playlist in playlists: self.assertEquals(type(playlist), Playlist)