'Scenario: On the Certificates tab of the Instructor Dashboard,
Error message appears if user is not enrolled in the course while trying to add a new exception.
Given that I am on the Certificates tab on the Instructor Dashboard
When I click on \'Add Exception\' button
AND student is not enrolled in the course
Then Error Message should say
"The user (username/email={user}) you have entered is not enrolled in this course.
Make sure the username or email address is correct, then try again."'

def test_user_not_enrolled_error(self):

    new_user = 'test_user_{uuid}'.format(uuid=self.unique_id[6:12])
    new_email = 'test_user_{uuid}@example.com'.format(uuid=self.unique_id[6:12])
    AutoAuthPage(self.browser, username=new_user, email=new_email).visit()
    (self.user_name, self.user_id) = self.log_in_as_instructor()
    self.instructor_dashboard_page.visit()
    self.certificates_section = self.instructor_dashboard_page.select_certificates()
    self.certificates_section.wait_for_certificate_exceptions_section()
    self.certificates_section.fill_user_name_field(new_user)
    self.certificates_section.click_add_exception_button()
    self.certificates_section.wait_for_ajax()
    self.assertIn('{user}    is    not    enrolled    in    this    course.    Please    check    your    spelling    and    retry.'.format(user=new_user), self.certificates_section.message.text)
