Exemplo n.º 1
0
 def test_invalid_image_file_info(self):
     """
     Test that when no file information is provided to validate_video_image, it gives proper error message.
     """
     error = validate_video_image({})
     self.assertEquals(
         error,
         'The image must have name, content type, and size information.')
Exemplo n.º 2
0
 def test_currupt_image_file(self):
     """
     Test that when corrupt file is provided to validate_video_image, it gives proper error message.
     """
     with open(settings.MEDIA_ROOT + '/test-corrupt-image.png', 'w+') as file:
         image_file = UploadedFile(
             file,
             content_type='image/png',
             size=settings.VIDEO_IMAGE_SETTINGS['VIDEO_IMAGE_MIN_BYTES']
         )
         error = validate_video_image(image_file)
         self.assertEquals(error, 'There is a problem with this image file. Try to upload a different file.')
Exemplo n.º 3
0
 def test_corrupt_image_file(self):
     """
     Test that when corrupt file is provided to validate_video_image, it gives proper error message.
     """
     with open(settings.MEDIA_ROOT + '/test-corrupt-image.png', 'w+') as file:
         image_file = UploadedFile(
             file,
             content_type='image/png',
             size=settings.VIDEO_IMAGE_SETTINGS['VIDEO_IMAGE_MIN_BYTES']
         )
         error = validate_video_image(image_file)
         self.assertEquals(error, 'There is a problem with this image file. Try to upload a different file.')
Exemplo n.º 4
0
 def test_invalid_image_file_info(self):
     """
     Test that when no file information is provided to validate_video_image, it gives proper error message.
     """
     error = validate_video_image({})
     self.assertEquals(error, 'The image must have name, content type, and size information.')