'The task should clone the OrganizationCourse and RestrictedCourse data.'

def test_success(self):

    old_course_key = self.course.id
    new_course_key = CourseLocator(org=old_course_key.org, course=old_course_key.course, run='rerun')
    old_course_id = str(old_course_key)
    new_course_id = str(new_course_key)
    organization = OrganizationFactory()
    OrganizationCourse.objects.create(course_id=old_course_id, organization=organization)
    restricted_course = RestrictedCourse.objects.create(course_key=self.course.id)
    restricted_country = Country.objects.create(country='US')
    CountryAccessRule.objects.create(rule_type=CountryAccessRule.BLACKLIST_RULE, restricted_course=restricted_course, country=restricted_country)
    self._rerun_course(old_course_key, new_course_key)
    course = modulestore().get_course(new_course_key)
    self.assertIsNotNone(course)
    self.assertEqual(OrganizationCourse.objects.count(), 2)
    OrganizationCourse.objects.get(course_id=new_course_id, organization=organization)
    self.assertEqual(RestrictedCourse.objects.count(), 2)
    restricted_course = RestrictedCourse.objects.get(course_key=new_course_key)
    self.assertEqual(CountryAccessRule.objects.count(), 2)
    CountryAccessRule.objects.get(rule_type=CountryAccessRule.BLACKLIST_RULE, restricted_course=restricted_course, country=restricted_country)
