'Test various resolutions of images to make thumbnails of.
Note that our test sizes are small=(200, 100) and large=(400, 200).
1. Images should won\'t be blown up if it\'s too small, so a (100, 50)
resolution image will remain (100, 50).
2. However, images *will* be converted using our format and quality
settings (JPEG, 75% -- the PIL default). This is because images with
relatively small dimensions not compressed properly.
3. Image thumbnail naming will maintain the naming convention of the
target resolution, even if the image was not actually scaled to that
size (i.e. it was already smaller). This is mostly because it\'s
simpler to be consistent, but it also lets us more easily tell which
configuration a thumbnail was created under.'

@ddt.data((800, 400), (800, 600), (300, 150), (300, 180), (100, 50), (100, 80), (800, 20), (20, 800))
def test_different_resolutions(self, src_dimensions):

    image = Image.new('RGB', src_dimensions, 'blue')
    image_buff = StringIO()
    image.save(image_buff, format='PNG')
    image_buff.seek(0)
    image_name = 'src_course_image.png'
    course = CourseFactory.create(course_image=image_name)
    course_image_asset_key = StaticContent.compute_location(course.id, course.course_image)
    course_image_content = StaticContent(course_image_asset_key, image_name, 'image/png', image_buff)
    contentstore().save(course_image_content)
    config = CourseOverviewImageConfig.current()
    course_overview = CourseOverview.get_from_id(course.id)
    image_urls = course_overview.image_urls
    for (image_url, target) in [(image_urls['small'], config.small), (image_urls['large'], config.large)]:
        image_key = StaticContent.get_location_from_path(image_url)
        image_content = AssetManager.find(image_key)
        image = Image.open(StringIO(image_content.data))
        self.assertTrue(image_url.endswith('src_course_image-png-{}x{}.jpg'.format(*target)))
        (src_x, src_y) = src_dimensions
        (target_x, target_y) = target
        (image_x, image_y) = image.size
        self.assertLessEqual(image_x, target_x)
        self.assertLessEqual(image_y, target_y)
        if ((src_x < target_x) and (src_y < target_y)):
            self.assertEqual(src_x, image_x)
            self.assertEqual(src_y, image_y)
