def test_imgur_is_unreachable(self): with patch('media.imgur._imgur.image', Mock(side_effect=stubs.Imgur.IsUnreachable)): self.assertEqual(get_hot_links('http://imgur.com/xyzxyz'), [])
def test_gallery_image(self): self.assertItemsEqual(get_hot_links('http://imgur.com/gallery/xyzxyz'), ['http://i.imgur.com/xyzxyz.jpg'])
def test_non_imgur(self): with self.assertRaises(DoesNotKnowHowToGetUrl): get_hot_links('http://google.com/xyzxyz')
def test_parameters(self): self.assertEqual(get_hot_links('http://i.imgur.com/xyzxyz.jpg?1'), ['http://i.imgur.com/xyzxyz.jpg']) self.assertEqual(get_hot_links('http://i.imgur.com/xyzxyz.jpg?1?4214'), ['http://i.imgur.com/xyzxyz.jpg'])
def test_gallery_album(self): self.assertItemsEqual(get_hot_links('http://imgur.com/gallery/foo'), [ 'http://i.imgur.com/xyzxyz.jpg', 'http://i.imgur.com/xyzxyy.png', ])
def test_album_with_extra_things(self): self.assertItemsEqual(get_hot_links('http://imgur.com/a/foo/titledesc'), [ 'http://i.imgur.com/xyzxyy.png', 'http://i.imgur.com/xyzxyz.jpg', ])
def test_anchor(self): self.assertItemsEqual(get_hot_links('http://imgur.com/a/foo#0'), [ 'http://i.imgur.com/xyzxyy.png', 'http://i.imgur.com/xyzxyz.jpg', ])
def test_many_image_ids(self): self.assertItemsEqual(get_hot_links('http://imgur.com/xyzxyz&xyzxyy'), [ 'http://i.imgur.com/xyzxyz.jpg', 'http://i.imgur.com/xyzxyy.png', ])
def test_image_id(self): self.assertEqual(get_hot_links('http://imgur.com/xyzxyz'), ['http://i.imgur.com/xyzxyz.jpg'])
def test_gif(self): self.assertEqual(get_hot_links('http://i.imgur.com/xyzxyx.gif'), ['http://i.imgur.com/xyzxyx.gif'])
def test_png(self): self.assertEqual(get_hot_links('http://i.imgur.com/xyzxyy.png'), ['http://i.imgur.com/xyzxyy.png'])
def test_jpeg(self): self.assertEqual(get_hot_links('http://i.imgur.com/xyzxyz.jpg'), ['http://i.imgur.com/xyzxyz.jpg']) self.assertEqual(get_hot_links('http://i.imgur.com/xyzxyx.jpeg'), ['http://i.imgur.com/xyzxyx.jpeg'])