'Test that it is possible to update the name of an existing random cohort.'

def test_update_random_cohort_name(self):

    cohort_name = 'I    AM    A    RANDOM    COHORT'
    data = {'name': cohort_name, 'assignment_type': CourseCohort.RANDOM}
    response_dict = self.put_handler(self.course, data=data)
    self.assertEqual(cohort_name, response_dict.get('name'))
    self.assertEqual(CourseCohort.RANDOM, response_dict.get('assignment_type'))
    newly_created_cohort = get_cohort_by_name(self.course.id, cohort_name)
    cohort_name = 'I    AM    AN    UPDATED    RANDOM    COHORT'
    data = {'name': cohort_name, 'assignment_type': CourseCohort.RANDOM}
    response_dict = self.put_handler(self.course, newly_created_cohort, data=data)
    self.assertEqual(cohort_name, get_cohort_by_id(self.course.id, newly_created_cohort.id).name)
    self.assertEqual(cohort_name, response_dict.get('name'))
    self.assertEqual(CourseCohort.RANDOM, response_dict.get('assignment_type'))
