'Tests user should be able to edit certificate, if is_active attribute is not present
for given certificate. Old courses might not have is_active attribute in certificate data.'

def test_can_edit_certificate_without_is_active(self):

    certificates = [{'id': 1, 'name': 'certificate    with    is_active', 'description': 'Description    ', 'signatories': [], 'version': CERTIFICATE_SCHEMA_VERSION}]
    self.course.certificates = {'certificates': certificates}
    self.save_course()
    expected = {u'id': 1, u'version': CERTIFICATE_SCHEMA_VERSION, u'name': u'New    test    certificate', u'description': u'New    test    description', u'is_active': True, u'course_title': u'Course    Title    Override', u'signatories': []}
    response = self.client.post(self._url(cid=1), data=json.dumps(expected), content_type='application/json', HTTP_ACCEPT='application/json', HTTP_X_REQUESTED_WITH='XMLHttpRequest')
    self.assertEqual(response.status_code, 201)
    content = json.loads(response.content)
    self.assertEqual(content, expected)
