'Tests that when a course is published or deleted, the corresponding
course_overview is removed from the cache.
Arguments:
modulestore_type (ModuleStoreEnum.Type): type of store to create the
course in.'

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

    with self.store.default_store(modulestore_type):
        course = CourseFactory.create(mobile_available=True, default_store=modulestore_type)
        course_overview_1 = CourseOverview.get_from_id(course.id)
        self.assertTrue(course_overview_1.mobile_available)
        course.mobile_available = False
        with self.store.branch_setting(ModuleStoreEnum.Branch.draft_preferred):
            self.store.update_item(course, ModuleStoreEnum.UserID.test)
        course_overview_2 = CourseOverview.get_from_id(course.id)
        self.assertFalse(course_overview_2.mobile_available)
        with self.assertRaises(CourseOverview.DoesNotExist):
            self.store.delete_course(course.id, ModuleStoreEnum.UserID.test)
            CourseOverview.get_from_id(course.id)
