'Activate and Deactivate the course certificate'

@ddt.data(C4X_SIGNATORY_PATH, SIGNATORY_PATH)
def test_certificate_activation_success(self, signatory_path):

    test_url = reverse_course_url('certificates.certificate_activation_handler', self.course.id)
    self._add_course_certificates(count=1, signatory_count=2, asset_path_format=signatory_path)
    is_active = True
    for i in range(2):
        if (i == 1):
            is_active = (not is_active)
        response = self.client.post(test_url, data=json.dumps({'is_active': is_active}), content_type='application/json', HTTP_ACCEPT='application/json', HTTP_X_REQUESTED_WITH='XMLHttpRequest')
        self.assertEquals(response.status_code, 200)
        course = self.store.get_course(self.course.id)
        certificates = course.certificates['certificates']
        self.assertEqual(certificates[0].get('is_active'), is_active)
        cert_event_type = ('activated' if is_active else 'deactivated')
        self.assert_event_emitted('.'.join(['edx.certificate.configuration', cert_event_type]), course_id=unicode(self.course.id))
