'Scenario: When errors occur when adding students to a cohort, the appropriate notification is shown.
Given I have a course with a cohort and a user already in it
When I add the user already in a cohort to that same cohort
And I add a non-existing user to that cohort
Then there is no change in the number of students in the cohort
And I get a notification that one user was already in the cohort
And I get a notification that one user is unknown
And the user input field still contains the incorrect email addresses'

def test_add_students_to_cohort_failure(self):

    self.cohort_management_page.select_cohort(self.manual_cohort_name)
    self.assertEqual(1, self.cohort_management_page.get_selected_cohort_count())
    self.cohort_management_page.add_students_to_selected_cohort([self.student_name, 'unknown_user'])
    EmptyPromise((lambda : (2 == len(self.cohort_management_page.get_cohort_confirmation_messages()))), 'Waiting    for    notification').fulfill()
    self.assertEqual(1, self.cohort_management_page.get_selected_cohort_count())
    self.assertEqual(['0    learners    have    been    added    to    this    cohort.', '1    learner    was    already    in    the    cohort'], self.cohort_management_page.get_cohort_confirmation_messages())
    self.assertEqual(['There    was    an    error    when    trying    to    add    learners:', 'Unknown    username:    unknown_user'], self.cohort_management_page.get_cohort_error_messages())
    self.assertEqual((self.student_name + ',unknown_user,'), self.cohort_management_page.get_cohort_student_input_field_value())
