'Test that audit mode students can receive a certificate if they are whitelisted.'

def test_ineligible_cert_whitelisted(self):

    CourseEnrollmentFactory(user=self.user_2, course_id=self.course.id, is_active=True, mode='audit')
    CertificateWhitelistFactory(course_id=self.course.id, user=self.user_2)
    with mock_passing_grade():
        with patch.object(XQueueInterface, 'send_to_queue') as mock_send:
            mock_send.return_value = (0, None)
            self.xqueue.add_cert(self.user_2, self.course.id)
    self.assertTrue(mock_send.called)
    certificate = GeneratedCertificate.certificate_for_student(self.user_2, self.course.id)
    self.assertIsNotNone(certificate)
    self.assertEqual(certificate.mode, 'audit')
