'Test that un-enrolling and re-enrolling works correctly. This is important because usually
learners maintain their previously assigned cohort on re-enrollment.'

def test_unenrolled(self):

    self._enable_cohorting()
    self._create_verified_cohort()
    self._enable_verified_track_cohorting()
    self._enroll_in_course()
    self._upgrade_to_verified()
    self.assertEqual(DEFAULT_VERIFIED_COHORT_NAME, get_cohort(self.user, self.course.id, assign=False).name)
    self._unenroll()
    self.assertEqual(DEFAULT_VERIFIED_COHORT_NAME, get_cohort(self.user, self.course.id, assign=False).name)
    self._reenroll()
    self.assertEqual(DEFAULT_COHORT_NAME, get_cohort(self.user, self.course.id, assign=False).name)
    self._upgrade_to_verified()
    self.assertEqual(DEFAULT_VERIFIED_COHORT_NAME, get_cohort(self.user, self.course.id, assign=False).name)
