Merge pull request #21619 from edx/awais786/BOM-416

Awais786/bom 416
This commit is contained in:
Awais Qureshi
2019-09-11 19:01:22 +05:00
committed by GitHub
2 changed files with 3 additions and 2 deletions

View File

@@ -3,6 +3,7 @@ from __future__ import absolute_import
import json
import six
from django.contrib.auth.models import AnonymousUser
from django.core.exceptions import PermissionDenied
from django.http import Http404
@@ -61,7 +62,7 @@ class NotificationPrefViewTest(UrlResetMixin, TestCase):
# now coerce username to utf-8 encoded str, since we test with non-ascii unicdoe above and
# the unittest framework has hard time coercing to unicode.
# decrypt also can't take a unicode input, so coerce its input to str
self.assertEqual(str(user.username.encode('utf-8')), UsernameCipher().decrypt(str(pref.value)))
self.assertEqual(six.binary_type(user.username.encode('utf-8')), UsernameCipher().decrypt(str(pref.value)))
def assertNotPrefExists(self, user):
"""Ensure that the user does not have a persisted preference"""

View File

@@ -413,7 +413,7 @@ def encode_entrance_exam_and_student_input(usage_key, student=None):
task_key_stub = "_{entranceexam}".format(entranceexam=text_type(usage_key))
# create the key value by using MD5 hash:
task_key = hashlib.md5(task_key_stub).hexdigest()
task_key = hashlib.md5(task_key_stub.encode('utf-8')).hexdigest()
return task_input, task_key