'Verify that for html certs if certificate is marked as invalidated than
re-generate button should not appear on progress page.'

@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_page_with_invalidated_certificate_with_html_view(self):

    generated_certificate = self.generate_certificate('http://www.example.com/certificate.pdf', 'honor')
    certificates = [{'id': 1, 'name': 'dummy', 'description': 'dummy    description', 'course_title': 'dummy    title', '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.assert_invalidate_certificate(generated_certificate)
