def test_gallery(self): """ Attempt Imgur gallery Download """ _task, _prog, _file = mock_handler_request( self.dir, 'https://imgur.com/gallery/plN58') res = imgur.handle(_task, _prog) self.assertTrue(res, "Imgur gallery search failed! %s" % res.failure_reason) self.assertEqual(len(res.album_urls), 134, "Handler didn't find all gallery URLS!")
def test_gif(self): """ Test gif download """ _task, _prog, _file = mock_handler_request(self.dir, 'imgur.com/r/gifs/jIuIbIu') res = imgur.handle(_task, _prog) self.assertTrue(res, "Imgur gif download failed!") self.assertTrue( _file.exists(), "Imgur gif was not downloaded! %s" % res.failure_reason) self.assertTrue(_file.relative().endswith('.mp4'), 'Failed to use .mp4 extension for .gif file!')
def test_indirect_link(self): """ Test an indirect png download """ _task, _prog, _file = mock_handler_request( self.dir, 'https://i.imgur.com/8770jp0') res = imgur.handle(_task, _prog) self.assertTrue(res, "Imgur indirect png download failed!") self.assertTrue( _file.exists(), "Imgur indirect png was not downloaded! %s" % res.failure_reason) self.assertIn('.png', _file.relative(), "Imgur indirect image is missing png extension!")
def test_invalid_album(self): """ Attempt to download an Animation, which (improperly) has an album prefix """ _task, _prog, _file = mock_handler_request( self.dir, 'https://imgur.com/a/KEVkAWf') res = imgur.handle(_task, _prog) self.assertTrue(res, "Imgur album download failed!") self.assertTrue( _file.exists(), "Imgur album animation was not downloaded! %s" % res.failure_reason) self.assertIn( '.mp4', _file.relative(), "Imgur downloaded the wrong animation format from album!")