BOM-622 Fix more type errors.
This commit is contained in:
@@ -346,7 +346,7 @@ class TestCoachDashboard(CcxTestCase, LoginEnrollmentTestCase):
|
|||||||
self.assertEqual(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
self.assertTrue(re.search(
|
self.assertTrue(re.search(
|
||||||
'<form action=".+create_ccx"',
|
'<form action=".+create_ccx"',
|
||||||
response.content))
|
response.content.decode('utf-8')))
|
||||||
|
|
||||||
def test_create_ccx_with_ccx_connector_set(self):
|
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."
|
"A CCX can only be created on this course through an external service."
|
||||||
" Contact a course admin to give you access."
|
" 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'):
|
def test_create_ccx(self, ccx_name='New CCX'):
|
||||||
"""
|
"""
|
||||||
@@ -392,7 +392,7 @@ class TestCoachDashboard(CcxTestCase, LoginEnrollmentTestCase):
|
|||||||
course_key = CourseKey.from_string(ccx_key)
|
course_key = CourseKey.from_string(ccx_key)
|
||||||
|
|
||||||
self.assertTrue(CourseEnrollment.is_enrolled(self.coach, course_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
|
# check if the max amount of student that can be enrolled has been overridden
|
||||||
ccx = CustomCourseForEdX.objects.get()
|
ccx = CustomCourseForEdX.objects.get()
|
||||||
@@ -1104,9 +1104,8 @@ class TestCCXGrades(FieldOverrideTestMixin, SharedModuleStoreTestCase, LoginEnro
|
|||||||
response['content-disposition'],
|
response['content-disposition'],
|
||||||
'attachment'
|
'attachment'
|
||||||
)
|
)
|
||||||
rows = response.content.strip().split('\r')
|
rows = response.content.decode('utf-8').strip().split('\r')
|
||||||
headers = rows[0]
|
headers = rows[0]
|
||||||
|
|
||||||
# picking first student records
|
# picking first student records
|
||||||
data = dict(list(zip(headers.strip().split(','), rows[1].strip().split(','))))
|
data = dict(list(zip(headers.strip().split(','), rows[1].strip().split(','))))
|
||||||
self.assertNotIn('HW 04', data)
|
self.assertNotIn('HW 04', data)
|
||||||
@@ -1276,7 +1275,7 @@ class TestStudentViewsWithCCX(ModuleStoreTestCase):
|
|||||||
self.client.login(username=self.student.username, password=self.student_password)
|
self.client.login(username=self.student.username, password=self.student_password)
|
||||||
response = self.client.get(reverse('dashboard'))
|
response = self.client.get(reverse('dashboard'))
|
||||||
self.assertEqual(response.status_code, 200)
|
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):
|
def test_load_courseware(self):
|
||||||
self.client.login(username=self.student.username, password=self.student_password)
|
self.client.login(username=self.student.username, password=self.student_password)
|
||||||
|
|||||||
@@ -539,7 +539,7 @@ def ccx_grades_csv(request, course, ccx=None):
|
|||||||
if not header:
|
if not header:
|
||||||
# Encode the header row in utf-8 encoding in case there are
|
# Encode the header row in utf-8 encoding in case there are
|
||||||
# unicode characters
|
# 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']]
|
for section in course_grade.summary[u'section_breakdown']]
|
||||||
rows.append(["id", "email", "username", "grade"] + header)
|
rows.append(["id", "email", "username", "grade"] + header)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user