Ejemplo n.º 1
0
 def test_is_valid_image_none(self):
     attachutil._imghdr = ImghdrMock('jpeg')
     self.assertFalse(attachutil.is_valid_image('image/png', None))
     self.assertEquals(None, attachutil._imghdr.path)
Ejemplo n.º 2
0
 def test_is_valid_image_not_same_image_type(self):
     attachutil._imghdr = ImghdrMock('jpeg')
     self.assertFalse(attachutil.is_valid_image('image/png', 'foo'))
     self.assertEquals('foo', attachutil._imghdr.path)
Ejemplo n.º 3
0
 def test_is_valid_image_type_isnot_image(self):
     attachutil._imghdr = ImghdrMock('png')
     self.assertFalse(attachutil.is_valid_image('text/html', 'foo'))
     self.assertEquals('foo', attachutil._imghdr.path)
Ejemplo n.º 4
0
 def test_is_valid_image_file_isnot_image(self):
     attachutil._imghdr = ImghdrMock(None)
     self.assertFalse(attachutil.is_valid_image('image/png', 'foo'))
     self.assertEquals('foo', attachutil._imghdr.path)
Ejemplo n.º 5
0
 def test_is_valid_image_true(self):
     attachutil._imghdr = ImghdrMock('png')
     self.assertTrue(attachutil.is_valid_image('image/png', 'foo'))
     self.assertEquals('foo', attachutil._imghdr.path)