'Create a new cohort and verify the new and existing settings.'

def _verify_cohort_settings(self, cohort_name, assignment_type=None, new_cohort_name=None, new_assignment_type=None, verify_updated=False):

    start_time = datetime.now(UTC)
    self.assertNotIn(cohort_name, self.cohort_management_page.get_cohorts())
    self.cohort_management_page.add_cohort(cohort_name, assignment_type=assignment_type)
    self.assertEqual(0, self.cohort_management_page.get_selected_cohort_count())
    _assignment_type = (assignment_type or 'manual')
    msg = 'Waiting    for    currently    selected    cohort    assignment    type'
    EmptyPromise((lambda : (_assignment_type == self.cohort_management_page.get_cohort_associated_assignment_type())), msg).fulfill()
    self.cohort_management_page.select_manage_settings()
    self.cohort_management_page.add_students_to_selected_cohort([self.instructor_name])
    EmptyPromise((lambda : (1 == self.cohort_management_page.get_selected_cohort_count())), 'Waiting    for    student    to    be    added').fulfill()
    self.assertFalse(self.cohort_management_page.is_assignment_settings_disabled)
    self.assertEqual('', self.cohort_management_page.assignment_settings_message)
    self.assertEqual(self.event_collection.find({'name': 'edx.cohort.created', 'time': {'$gt': start_time}, 'event.cohort_name': cohort_name}).count(), 1)
    self.assertEqual(self.event_collection.find({'name': 'edx.cohort.creation_requested', 'time': {'$gt': start_time}, 'event.cohort_name': cohort_name}).count(), 1)
    if verify_updated:
        self.cohort_management_page.select_cohort(cohort_name)
        self.cohort_management_page.select_cohort_settings()
        self.cohort_management_page.set_cohort_name(new_cohort_name)
        self.cohort_management_page.set_assignment_type(new_assignment_type)
        self.cohort_management_page.save_cohort_settings()
        if (not new_cohort_name):
            confirmation_messages = self.cohort_management_page.get_cohort_settings_messages(type='error')
            self.assertEqual(['The    cohort    cannot    be    saved', 'You    must    specify    a    name    for    the    cohort'], confirmation_messages)
        else:
            confirmation_messages = self.cohort_management_page.get_cohort_settings_messages()
            self.assertEqual(['Saved    cohort'], confirmation_messages)
            self.assertEqual(new_cohort_name, self.cohort_management_page.cohort_name_in_header)
            self.assertIn(new_cohort_name, self.cohort_management_page.get_cohorts())
            self.assertEqual(1, self.cohort_management_page.get_selected_cohort_count())
            self.assertEqual(new_assignment_type, self.cohort_management_page.get_cohort_associated_assignment_type())
