def setup_playlist(self): self.manual_feed = testobjects.make_manual_feed() items = testobjects.add_items_to_feed(self.manual_feed, 10, file_items=True, prefix='playlist-') self.playlist = models.SavedPlaylist(u'playlist', [i.id for i in items]) self.playlist_items = items
def test_changes(self): self.assertEquals(self.items_changed_callback.call_count, 0) # make changes that don't add/remove items from the list self.items[0].set_user_metadata({'title': u'new title'}) self.items[0].signal_change() self.items[1].set_user_metadata({'title': u'new title'}) self.items[1].signal_change() self.process_item_changes() self.check_callback(added=[], changed=self.items[:2], removed=[]) # make changes that add/remove items from the list. self.items[0].remove() new_items = testobjects.add_items_to_feed(self.feed, 5, file_items=True) self.items[1].set_user_metadata({'title': u'newer title'}) self.items[1].signal_change() self.other_items[0].set_feed(self.feed.id) self.process_item_changes() self.check_callback(added=new_items + [self.other_items[0]], changed=[self.items[1]], removed=[self.items[0]])