From 401e15b8bdb89744d8eabf22a18dd5b0c61f51a8 Mon Sep 17 00:00:00 2001 From: Ayub khan Date: Fri, 23 Aug 2019 14:44:35 +0500 Subject: [PATCH] BOM-241 py3 Assetion Error Fix --- lms/djangoapps/instructor/tests/test_api.py | 2 +- lms/djangoapps/instructor_analytics/csvs.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lms/djangoapps/instructor/tests/test_api.py b/lms/djangoapps/instructor/tests/test_api.py index e623632bb6..0724566661 100644 --- a/lms/djangoapps/instructor/tests/test_api.py +++ b/lms/djangoapps/instructor/tests/test_api.py @@ -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 + '"' ) diff --git a/lms/djangoapps/instructor_analytics/csvs.py b/lms/djangoapps/instructor_analytics/csvs.py index a5ca1c5f6e..67700a8ddb 100644 --- a/lms/djangoapps/instructor_analytics/csvs.py +++ b/lms/djangoapps/instructor_analytics/csvs.py @@ -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