Пример #1
0
    def test_remove_before_downloader_referenced(self):
        # when items are restored from the DB, the downloader
        # attribute is loaded lazily.  Make sure that if we remove the
        # item, the downloader is still removed.
        feed = Feed(u'http://example.com/1')
        item = Item(fp_values_for_url(u'http://example.com/1/item1'),
                    feed_id=feed.id)
        item.set_downloader(
            RemoteDownloader(u'http://example.com/1/item1/movie.mpeg', item))
        downloader = item.downloader

        feed = self.reload_object(feed)
        downloader = self.reload_object(downloader)
        item = self.reload_object(item)

        item.remove()
        self.assert_(not downloader.id_exists())
Пример #2
0
 def make_regular_item(self, feed):
     url = u'http://example.com/1/item1'
     item = Item(fp_values_for_url(url), feed_id=feed.id)
     item.set_downloader(RemoteDownloader(url, item))
     return item