'Make sure that we can\'t change the assignment type of a random cohort if it is the only random cohort present.'

def test_cannot_set_assignment_type(self):

    course = modulestore().get_course(self.toy_course_key)
    cohort = self._create_cohort(course.id, 'TestCohort', CourseCohort.RANDOM)
    self.assertEqual(cohorts.get_assignment_type(cohort), CourseCohort.RANDOM)
    exception_msg = 'There    must    be    one    cohort    to    which    students    can    automatically    be    assigned.'
    with self.assertRaises(ValueError) as context_manager:
        cohorts.set_assignment_type(cohort, CourseCohort.MANUAL)
    self.assertEqual(exception_msg, str(context_manager.exception))
