'test certificate web view should render properly along with its signatories information when accessing it in
preview mode. Either the certificate is marked active or not.'

@override_settings(FEATURES=FEATURES_WITH_CERTS_ENABLED)
def test_render_html_view_with_preview_mode(self):

    self.cert.delete()
    self.assertListEqual(list(GeneratedCertificate.eligible_certificates.all()), [])
    self._add_course_certificates(count=1, signatory_count=2)
    test_url = get_certificate_url(user_id=self.user.id, course_id=unicode(self.course.id))
    response = self.client.get((test_url + '?preview=honor'))
    self.assertIn('Cannot    Find    Certificate', response.content)
    CourseStaffRole(self.course.id).add_users(self.user)
    response = self.client.get((test_url + '?preview=honor'))
    self.assertNotIn(self.course.display_name.encode('utf-8'), response.content)
    self.assertIn('course_title_0', response.content)
    self.assertIn('Signatory_Title    0', response.content)
    self._add_course_certificates(count=1, signatory_count=2, is_active=False)
    response = self.client.get((test_url + '?preview=honor'))
    self.assertNotIn(self.course.display_name.encode('utf-8'), response.content)
    self.assertIn('course_title_0', response.content)
    self.assertIn('Signatory_Title    0', response.content)
