'Test that we return CDN prefixed URLs if it is enabled.'

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

    with self.store.default_store(modulestore_type):
        course = CourseFactory.create(default_store=modulestore_type)
        overview = CourseOverview.get_from_id(course.id)
        AssetBaseUrlConfig.objects.all().delete()
        if (modulestore_type == ModuleStoreEnum.Type.mongo):
            expected_path_start = '/c4x/'
        elif (modulestore_type == ModuleStoreEnum.Type.split):
            expected_path_start = '/asset-v1:'
        for url in overview.image_urls.values():
            self.assertTrue(url.startswith(expected_path_start))
        AssetBaseUrlConfig.objects.create(enabled=True, base_url='fakecdn.edx.org')
        expected_cdn_url = ('//fakecdn.edx.org' + expected_path_start)
        for url in overview.image_urls.values():
            self.assertTrue(url.startswith(expected_cdn_url))
