'Verify that the server response contains the expected_cohorts.
If response_dict is None, the list of cohorts is requested from the server.'

def verify_lists_expected_cohorts(self, expected_cohorts, response_dict=None):

    if (response_dict is None):
        response_dict = self.get_handler(self.course)
    self.assertEqual(response_dict.get('cohorts'), [{'name': cohort.name, 'id': cohort.id, 'user_count': cohort.user_count, 'assignment_type': cohort.assignment_type, 'user_partition_id': None, 'group_id': None} for cohort in expected_cohorts])
