diff --git a/common/djangoapps/student/tests/test_models.py b/common/djangoapps/student/tests/test_models.py index ae597d9262..d57c5a2286 100644 --- a/common/djangoapps/student/tests/test_models.py +++ b/common/djangoapps/student/tests/test_models.py @@ -81,7 +81,7 @@ class CourseEnrollmentTests(SharedModuleStoreTestCase): expected = '{username}&{course_id}={mode}'.format( username=self.user.username, course_id=str(course_id).lower(), mode=enrollment_mode.lower() ) - expected = hashlib.md5(expected).hexdigest() + expected = hashlib.md5(expected.encode('utf-8')).hexdigest() self.assertEqual(CourseEnrollment.generate_enrollment_status_hash(self.user), expected) self.assert_enrollment_status_hash_cached(self.user, expected) @@ -92,7 +92,7 @@ class CourseEnrollmentTests(SharedModuleStoreTestCase): hash_elements += [ '{course_id}={mode}'.format(course_id=str(enrollment.course_id).lower(), mode=enrollment.mode.lower()) for enrollment in enrollments] - expected = hashlib.md5('&'.join(hash_elements)).hexdigest() + expected = hashlib.md5('&'.join(hash_elements).encode('utf-8')).hexdigest() self.assertEqual(CourseEnrollment.generate_enrollment_status_hash(self.user), expected) self.assert_enrollment_status_hash_cached(self.user, expected)