Fix Python 3 bug in LTI stub server BOM-1006 (#22260)

This commit is contained in:
Jeremy Bowman
2019-11-08 08:42:56 -05:00
committed by GitHub
parent 923452514b
commit e0a22db806
3 changed files with 6 additions and 3 deletions

View File

@@ -267,7 +267,7 @@ class StubLtiHandler(StubHttpRequestHandler):
# Calculate and encode body hash. See http://oauth.googlecode.com/svn/spec/ext/body_hash/1.0/oauth-bodyhash.html
sha1 = hashlib.sha1()
sha1.update(body.encode('utf-8'))
oauth_body_hash = six.text_type(base64.b64encode(sha1.digest()))
oauth_body_hash = base64.b64encode(sha1.digest()).decode('utf-8')
mock_request = mock.Mock(
uri=six.text_type(six.moves.urllib.parse.unquote(url)),
headers=headers,

View File

@@ -19,7 +19,7 @@ from ...pages.lms.courseware import CoursewarePage, LTIContentIframe
from ..helpers import UniqueCourseTest, auto_auth, select_option_by_text
class TestLTIConusmer(UniqueCourseTest):
class TestLTIConsumer(UniqueCourseTest):
"""
Base class for tests of LTI xblock in the LMS.
"""
@@ -29,7 +29,7 @@ class TestLTIConusmer(UniqueCourseTest):
host = os.environ.get('BOK_CHOY_HOSTNAME', '127.0.0.1')
def setUp(self):
super(TestLTIConusmer, self).setUp()
super(TestLTIConsumer, self).setUp()
self.courseware_page = CoursewarePage(self.browser, self.course_id)
self.lti_iframe = LTIContentIframe(self.browser, self.course_id)
self.tab_nav = TabNavPage(self.browser)

View File

@@ -139,6 +139,9 @@ def recalculate_course_and_subsection_grades_for_user(self, **kwargs): # pylint
Recalculates the course grade and all subsection grades
for the given ``user`` and ``course_key`` keyword arguments.
"""
if 'lms.djangoapps.grades.apps.GradesConfig' not in settings.INSTALLED_APPS:
# This task errors when run in-process during Studio tests, just skip it
return
user_id = kwargs.get('user_id')
course_key_str = kwargs.get('course_key')