Exemplo n.º 1
0
 def test_Image_setFormat(self):
     # Setting the format must also set the content_type property
     image = Image('testimage', format='image/jpeg')
     self.assertEqual(image.Format(), 'image/jpeg')
     self.assertEqual(image.content_type, 'image/jpeg')
     image.setFormat('image/gif')
     self.assertEqual(image.Format(), 'image/gif')
     self.assertEqual(image.content_type, 'image/gif')
Exemplo n.º 2
0
 def test_ImageContentTypeUponConstruction(self):
     # Test the content type after calling the constructor with the
     # file object being passed in (http://www.zope.org/Collectors/CMF/370)
     testfile = open(TEST_JPG, 'rb')
     image = Image('testimage', file=testfile)
     testfile.close()
     self.assertEqual(image.Format(), 'image/jpeg')
     self.assertEqual(image.content_type, 'image/jpeg')