From e0a22db80652f5a54a23323cc7dcdeaa8aad54f7 Mon Sep 17 00:00:00 2001 From: Jeremy Bowman <jbowman@edx.org> Date: Fri, 8 Nov 2019 08:42:56 -0500 Subject: [PATCH] Fix Python 3 bug in LTI stub server BOM-1006 (#22260) --- common/djangoapps/terrain/stubs/lti.py | 2 +- common/test/acceptance/tests/lms/test_lms_lti.py | 4 ++-- lms/djangoapps/grades/tasks.py | 3 +++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/common/djangoapps/terrain/stubs/lti.py b/common/djangoapps/terrain/stubs/lti.py index ff0f430c34d..f5629911242 100644 --- a/common/djangoapps/terrain/stubs/lti.py +++ b/common/djangoapps/terrain/stubs/lti.py @@ -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, diff --git a/common/test/acceptance/tests/lms/test_lms_lti.py b/common/test/acceptance/tests/lms/test_lms_lti.py index ae013d1a696..886b12e1d08 100644 --- a/common/test/acceptance/tests/lms/test_lms_lti.py +++ b/common/test/acceptance/tests/lms/test_lms_lti.py @@ -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) diff --git a/lms/djangoapps/grades/tasks.py b/lms/djangoapps/grades/tasks.py index 5c715537bc0..a3ea2dcb19d 100644 --- a/lms/djangoapps/grades/tasks.py +++ b/lms/djangoapps/grades/tasks.py @@ -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') -- GitLab