def test_get_image_data_and_filename(self): uri = 'http://httpbin.org/image/png' mock_request(uri, method='GET', status=200, fixture='image1.png', include_location=False) img_data, filename = image.get_image_data_and_filename(uri, 'png.png') local_data = get_fixture('image1.png', as_binary=True) self.assertEqual(local_data, img_data) self.assertEqual(filename, 'png')
def test_get_image_data_and_filename_empty_input(self): img_data = '' img_data, filename = image.get_image_data_and_filename(img_data, 'png.png') self.assertEqual('', img_data) self.assertEqual('png.png', filename)