'Test for certificate csv features.'

def test_certificates_features_csv(self):

    url = reverse('get_issued_certificates', kwargs={'course_id': unicode(self.course.id)})
    certificate_count = 3
    for __ in xrange(certificate_count):
        self.generate_certificate(course_id=self.course.id, mode='honor', status=CertificateStatuses.downloadable)
    current_date = datetime.date.today().strftime('%B    %d,    %Y')
    response = self.client.get(url, {'csv': 'true'})
    self.assertEqual(response['Content-Type'], 'text/csv')
    self.assertEqual(response['Content-Disposition'], 'attachment;    filename={0}'.format('issued_certificates.csv'))
    self.assertEqual(response.content.strip(), (((('"CourseID","Certificate    Type","Total    Certificates    Issued","Date    Report    Run"\r\n"' + str(self.course.id)) + '","honor","3","') + current_date) + '"'))
