ImageFields now include PIL error messages if invalid error (#353)
This commit is contained in:
parent
a246154961
commit
e5648a4af9
3 changed files with 14 additions and 2 deletions
|
|
@ -269,6 +269,17 @@ class FileTest(unittest.TestCase):
|
|||
|
||||
TestImage.drop_collection()
|
||||
|
||||
with tempfile.TemporaryFile() as f:
|
||||
f.write(b("Hello World!"))
|
||||
f.flush()
|
||||
|
||||
t = TestImage()
|
||||
try:
|
||||
t.image.put(f)
|
||||
self.fail("Should have raised an invalidation error")
|
||||
except ValidationError, e:
|
||||
self.assertEquals("%s" % e, "Invalid image: cannot identify image file")
|
||||
|
||||
t = TestImage()
|
||||
t.image.put(open(TEST_IMAGE_PATH, 'rb'))
|
||||
t.save()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue