BOM-622 Fix more type errors.

This commit is contained in:
Feanil Patel
2019-09-19 16:57:54 -04:00
parent 0e1ad4cd26
commit 0c1e18ff53
2 changed files with 6 additions and 7 deletions

View File

@@ -346,7 +346,7 @@ class TestCoachDashboard(CcxTestCase, LoginEnrollmentTestCase):
self.assertEqual(response.status_code, 200)
self.assertTrue(re.search(
'<form action=".+create_ccx"',
response.content))
response.content.decode('utf-8')))
def test_create_ccx_with_ccx_connector_set(self):
"""
@@ -365,7 +365,7 @@ class TestCoachDashboard(CcxTestCase, LoginEnrollmentTestCase):
"A CCX can only be created on this course through an external service."
" Contact a course admin to give you access."
)
self.assertTrue(re.search(error_message, response.content))
self.assertTrue(re.search(error_message, response.content.decode('utf-8')))
def test_create_ccx(self, ccx_name='New CCX'):
"""
@@ -392,7 +392,7 @@ class TestCoachDashboard(CcxTestCase, LoginEnrollmentTestCase):
course_key = CourseKey.from_string(ccx_key)
self.assertTrue(CourseEnrollment.is_enrolled(self.coach, course_key))
self.assertTrue(re.search('id="ccx-schedule"', response.content))
self.assertTrue(re.search('id="ccx-schedule"', response.content.decode('utf-8')))
# check if the max amount of student that can be enrolled has been overridden
ccx = CustomCourseForEdX.objects.get()
@@ -1104,9 +1104,8 @@ class TestCCXGrades(FieldOverrideTestMixin, SharedModuleStoreTestCase, LoginEnro
response['content-disposition'],
'attachment'
)
rows = response.content.strip().split('\r')
rows = response.content.decode('utf-8').strip().split('\r')
headers = rows[0]
# picking first student records
data = dict(list(zip(headers.strip().split(','), rows[1].strip().split(','))))
self.assertNotIn('HW 04', data)
@@ -1276,7 +1275,7 @@ class TestStudentViewsWithCCX(ModuleStoreTestCase):
self.client.login(username=self.student.username, password=self.student_password)
response = self.client.get(reverse('dashboard'))
self.assertEqual(response.status_code, 200)
self.assertTrue(re.search('Test CCX', response.content))
self.assertTrue(re.search('Test CCX', response.content.decode('utf-8')))
def test_load_courseware(self):
self.client.login(username=self.student.username, password=self.student_password)

View File

@@ -539,7 +539,7 @@ def ccx_grades_csv(request, course, ccx=None):
if not header:
# Encode the header row in utf-8 encoding in case there are
# unicode characters
header = [section['label'].encode('utf-8')
header = [section['label'].encode('utf-8') if six.PY2 else section['label']
for section in course_grade.summary[u'section_breakdown']]
rows.append(["id", "email", "username", "grade"] + header)