'Scenario: On the Certificates tab of the Instructor Dashboard, Instructor should see error message if
the student entered for certificate invalidation is not enrolled in the course.
Given that I am on the certificates tab on the Instructor Dashboard
When I click "Invalidate Certificate"
AND the username entered is not enrolled in the current course
Then I see following error message
"{user} is not enrolled in this course. Please check your spelling and retry."'

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_invalidations_section()
    self.certificates_section.fill_certificate_invalidation_user_name_field(new_user)
    self.certificates_section.click_invalidate_certificate_button()
    self.certificates_section.wait_for_ajax()
    self.assertIn(u'{user}    is    not    enrolled    in    this    course.    Please    check    your    spelling    and    retry.'.format(user=new_user), self.certificates_section.certificate_invalidation_message.text)
