def test_okay(self): fp = StringIO(one_pixel_jpeg) compare( is_image(dict(mimetype='image/jpeg', fp=fp)), True ) compare(fp.tell(),0)
def test_not_image_data(self): compare( is_image(dict(mimetype='image/jpeg', fp=StringIO('foo'))), 'This file is not an image' )
def test_wrong_mimetype(self): compare( is_image(dict(mimetype='foo')), 'This file is not an image' )