def test_update_items_download_arg_true(self): feed_content = ''' <rss version="2.0"> <channel> <title>Fake Feed</title> <item> <guid isPermaLink="false">/ep123.mp3</guid> <enclosure url="http://example.com/ep123.mp3" type="audio/mpeg" /> </item> </channel> </rss> ''' tree = etree.fromstring(feed_content).find('channel') channel = PodcastChannel.objects.create(url='http://example.com') self.mock.StubOutWithMock(PodcastItem, 'download_file') PodcastItem.download_file() self.mock.StubOutWithMock(model_logger, 'info') model_logger.info('Found 1 new items') self.mock.ReplayAll() channel.update_items(tree, download=True) self.mock.VerifyAll() item = channel.podcast_items.get() self.assertEqual(channel.podcast_items.count(), 1) self.assertEqual(item.guid, '/ep123.mp3')
def test_update_items_download_arg_true(self): feed_content = ''' <rss version="2.0"> <channel> <title>Fake Feed</title> <item> <guid isPermaLink="false">/ep123.mp3</guid> <enclosure url="http://example.com/ep123.mp3" type="audio/mpeg" /> </item> </channel> </rss> ''' tree = etree.fromstring(feed_content).find('channel') channel = PodcastChannel.objects.create(url='http://example.com') self.mock.StubOutWithMock(PodcastItem, 'download_file') PodcastItem.download_file() self.mock.StubOutWithMock(model_logger, 'info') model_logger.info('Found 1 new items') self.mock.ReplayAll() channel.update_items(tree, download=True) self.mock.VerifyAll() item = channel.podcast_items.get() self.assertEqual(channel.podcast_items.count(), 1) self.assertEqual(item.guid, '/ep123.mp3')
def test_download_file(self): self.mock.StubOutWithMock(PodcastItem, 'download_file') PodcastItem.download_file() self.mock.ReplayAll() tasks.download_file(33) self.mock.VerifyAll()