py3 Assetion Error Fix
This commit is contained in:
Ayub khan
2019-08-23 14:44:35 +05:00
parent 81a99e4d32
commit 401e15b8bd
2 changed files with 3 additions and 3 deletions

View File

@@ -4764,7 +4764,7 @@ class TestCourseIssuedCertificatesData(SharedModuleStoreTestCase):
self.assertEqual(response['Content-Type'], 'text/csv')
self.assertEqual(response['Content-Disposition'], u'attachment; filename={0}'.format('issued_certificates.csv'))
self.assertEqual(
response.content.strip(),
response.content.strip().decode('utf-8'),
'"CourseID","Certificate Type","Total Certificates Issued","Date Report Run"\r\n"'
+ str(self.course.id) + '","honor","3","' + current_date + '"'
)

View File

@@ -32,11 +32,11 @@ def create_csv_response(filename, header, datarows):
quotechar='"',
quoting=csv.QUOTE_ALL)
encoded_header = [six.text_type(s).encode('utf-8') for s in header]
encoded_header = [six.text_type(s) for s in header]
csvwriter.writerow(encoded_header)
for datarow in datarows:
encoded_row = [six.text_type(s).encode('utf-8') for s in datarow]
encoded_row = [six.text_type(s) for s in datarow]
csvwriter.writerow(encoded_row)
return response