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.assertEqual( error, 'The image must have name, content type, and size information.')
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 image_file: uploaded_image_file = UploadedFile( image_file, content_type='image/png', size=settings.VIDEO_IMAGE_SETTINGS['VIDEO_IMAGE_MIN_BYTES'] ) error = validate_video_image(uploaded_image_file) self.assertEqual(error, 'There is a problem with this image file. Try to upload a different file.')