'Test a scenario where thumbnails cannot be generated.
We need to make sure that:
1. We don\'t cause any 500s to leak out. A failure to generate thumbnails
should never cause CourseOverview generation to fail.
2. We return the raw course image for all resolutions.
3. We don\'t kill our CPU by trying over and over again.'

@ddt.data(ModuleStoreEnum.Type.mongo, ModuleStoreEnum.Type.split)
def test_error_generating_thumbnails(self, modulestore_type):

    with mock.patch('openedx.core.lib.courses.create_course_image_thumbnail') as patched_create_thumbnail:
        fake_course_image = 'sample_image.png'
        patched_create_thumbnail.side_effect = Exception('Kaboom!')
        course_overview = self._assert_image_urls_all_default(modulestore_type, fake_course_image)
        patched_create_thumbnail.assert_called()
    self.assertTrue(hasattr(course_overview, 'image_set'))
    self.assertEqual(course_overview.image_set.small_url, '')
    self.assertEqual(course_overview.image_set.large_url, '')
    with mock.patch('openedx.core.lib.courses.create_course_image_thumbnail') as patched_create_thumbnail:
        course_overview = CourseOverview.get_from_id(course_overview.id)
        patched_create_thumbnail.assert_not_called()
