'If certificate web view is enabled then certificate web view button should appear for user who certificate is
available/generated'

@patch.dict('django.conf.settings.FEATURES', {'CERTIFICATES_HTML_VIEW': True})
@patch('lms.djangoapps.grades.new.course_grade.CourseGrade.summary', PropertyMock(return_value={'grade': 'Pass', 'percent': 0.75, 'section_breakdown': [], 'grade_breakdown': {}}))
def test_view_certificate_link(self):

    certificate = GeneratedCertificateFactory.create(user=self.user, course_id=self.course.id, status=CertificateStatuses.downloadable, download_url='http://www.example.com/certificate.pdf', mode='honor')
    CertificateGenerationConfiguration(enabled=True).save()
    certs_api.set_cert_generation_enabled(self.course.id, True)
    certificates = [{'id': 1, 'name': 'Name    1', 'description': 'Description    1', 'course_title': 'course_title_1', 'signatories': [], 'version': 1, 'is_active': True}]
    self.course.certificates = {'certificates': certificates}
    self.course.cert_html_view_enabled = True
    self.course.save()
    self.store.update_item(self.course, self.user.id)
    resp = self._get_progress_page()
    self.assertContains(resp, u'View    Certificate')
    self.assertContains(resp, u'You    can    keep    working    for    a    higher    grade')
    cert_url = certs_api.get_certificate_url(course_id=self.course.id, uuid=certificate.verify_uuid)
    self.assertContains(resp, cert_url)
    certificates[0]['is_active'] = False
    self.store.update_item(self.course, self.user.id)
    resp = self._get_progress_page()
    self.assertNotContains(resp, u'View    Your    Certificate')
    self.assertNotContains(resp, u'You    can    now    view    your    certificate')
    self.assertContains(resp, 'working    on    it...')
    self.assertContains(resp, 'creating    your    certificate')
