'Test video image validation gives proper error message.
Arguments:
image_data (Dict): Specific data to create image file.
error_message (String): Error message'

@ddt.data(({'extension': '.png'}, None), ({'extension': '.gif'}, None), ({'extension': '.bmp'}, None), ({'extension': '.jpg'}, None), ({'extension': '.jpeg'}, None), ({'extension': '.PNG'}, None), ({'extension': '.tiff'}, 'This    image    file    type    is    not    supported.    Supported    file    types    are    {supported_file_formats}.'.format(supported_file_formats=settings.VIDEO_IMAGE_SUPPORTED_FILE_FORMATS.keys())), ({'size': (settings.VIDEO_IMAGE_SETTINGS['VIDEO_IMAGE_MAX_BYTES'] + 10)}, 'This    image    file    must    be    smaller    than    {image_max_size}.'.format(image_max_size=settings.VIDEO_IMAGE_MAX_FILE_SIZE_MB)), ({'size': (settings.VIDEO_IMAGE_SETTINGS['VIDEO_IMAGE_MIN_BYTES'] - 10)}, 'This    image    file    must    be    larger    than    {image_min_size}.'.format(image_min_size=settings.VIDEO_IMAGE_MIN_FILE_SIZE_KB)), ({'width': 16, 'height': 9}, 'Recommended    image    resolution    is    {image_file_max_width}x{image_file_max_height}.    The    minimum    resolution    is    {image_file_min_width}x{image_file_min_height}.'.format(image_file_max_width=settings.VIDEO_IMAGE_MAX_WIDTH, image_file_max_height=settings.VIDEO_IMAGE_MAX_HEIGHT, image_file_min_width=settings.VIDEO_IMAGE_MIN_WIDTH, image_file_min_height=settings.VIDEO_IMAGE_MIN_HEIGHT)), ({'width': (settings.VIDEO_IMAGE_MIN_WIDTH - 10), 'height': settings.VIDEO_IMAGE_MIN_HEIGHT}, 'Recommended    image    resolution    is    {image_file_max_width}x{image_file_max_height}.    The    minimum    resolution    is    {image_file_min_width}x{image_file_min_height}.'.format(image_file_max_width=settings.VIDEO_IMAGE_MAX_WIDTH, image_file_max_height=settings.VIDEO_IMAGE_MAX_HEIGHT, image_file_min_width=settings.VIDEO_IMAGE_MIN_WIDTH, image_file_min_height=settings.VIDEO_IMAGE_MIN_HEIGHT)), ({'width': settings.VIDEO_IMAGE_MIN_WIDTH, 'height': (settings.VIDEO_IMAGE_MIN_HEIGHT - 10)}, 'Recommended    image    resolution    is    {image_file_max_width}x{image_file_max_height}.    The    minimum    resolution    is    {image_file_min_width}x{image_file_min_height}.'.format(image_file_max_width=settings.VIDEO_IMAGE_MAX_WIDTH, image_file_max_height=settings.VIDEO_IMAGE_MAX_HEIGHT, image_file_min_width=settings.VIDEO_IMAGE_MIN_WIDTH, image_file_min_height=settings.VIDEO_IMAGE_MIN_HEIGHT)), ({'width': 1200, 'height': 100}, 'Recommended    image    resolution    is    {image_file_max_width}x{image_file_max_height}.    The    minimum    resolution    is    {image_file_min_width}x{image_file_min_height}.'.format(image_file_max_width=settings.VIDEO_IMAGE_MAX_WIDTH, image_file_max_height=settings.VIDEO_IMAGE_MAX_HEIGHT, image_file_min_width=settings.VIDEO_IMAGE_MIN_WIDTH, image_file_min_height=settings.VIDEO_IMAGE_MIN_HEIGHT)), ({'width': settings.VIDEO_IMAGE_MAX_WIDTH, 'height': settings.VIDEO_IMAGE_MAX_HEIGHT}, None), ({'width': 850, 'height': 478}, None), ({'width': 940, 'height': 560}, None), ({'width': (settings.VIDEO_IMAGE_MIN_WIDTH + 100), 'height': (settings.VIDEO_IMAGE_MIN_HEIGHT + 200)}, 'This    image    file    must    have    an    aspect    ratio    of    {video_image_aspect_ratio_text}.'.format(video_image_aspect_ratio_text=settings.VIDEO_IMAGE_ASPECT_RATIO_TEXT)), ({'prefix': u'n\xf8n-\xe5\xdf\xe7\xa1\xa1'}, 'The    image    file    name    can    only    contain    letters,    numbers,    hyphens    (-),    and    underscores    (_).'))
@ddt.unpack
@override_switch(VIDEO_IMAGE_UPLOAD_ENABLED, True)
def test_video_image_validation_message(self, image_data, error_message):

    edx_video_id = 'test1'
    video_image_upload_url = self.get_url_for_course_key(self.course.id, {'edx_video_id': edx_video_id})
    with make_image_file(dimensions=(image_data.get('width', settings.VIDEO_IMAGE_MIN_WIDTH), image_data.get('height', settings.VIDEO_IMAGE_MIN_HEIGHT)), prefix=image_data.get('prefix', 'videoimage'), extension=image_data.get('extension', '.png'), force_size=image_data.get('size', settings.VIDEO_IMAGE_SETTINGS['VIDEO_IMAGE_MIN_BYTES'])) as image_file:
        response = self.client.post(video_image_upload_url, {'file': image_file}, format='multipart')
        if error_message:
            self.verify_error_message(response, error_message)
        else:
            self.verify_image_upload_reponse(self.course.id, edx_video_id, response)
