Skip to content
Snippets Groups Projects
Commit 6dc70a67 authored by Stu Young's avatar Stu Young Committed by Douglas Hall
Browse files

incr-310 (#20615)

* run python modernize

* run isort

* Add oauth2_handler module docstring.
parent 175c3c6d
No related branches found
No related tags found
No related merge requests found
""" Handlers for OpenID Connect provider. """
from __future__ import absolute_import
from oauth2_handler.handlers import IDTokenHandler, UserInfoHandler from oauth2_handler.handlers import IDTokenHandler, UserInfoHandler
""" Handlers for OpenID Connect provider. """ """ Handlers for OpenID Connect provider. """
from __future__ import absolute_import
import six
from django.conf import settings from django.conf import settings
from django.core.cache import cache from django.core.cache import cache
...@@ -209,7 +212,7 @@ class CourseAccessHandler(object): ...@@ -209,7 +212,7 @@ class CourseAccessHandler(object):
if not GlobalStaff().has_user(user): if not GlobalStaff().has_user(user):
course_keys = [course_key for course_key in course_keys if has_access(user, access_type, course_key)] course_keys = [course_key for course_key in course_keys if has_access(user, access_type, course_key)]
course_ids = [unicode(course_key) for course_key in course_keys] course_ids = [six.text_type(course_key) for course_key in course_keys]
cache.set(key, course_ids, self.COURSE_CACHE_TIMEOUT) cache.set(key, course_ids, self.COURSE_CACHE_TIMEOUT)
......
# pylint: disable=missing-docstring # pylint: disable=missing-docstring
from __future__ import absolute_import
import mock import mock
import six
from django.core.cache import cache from django.core.cache import cache
from django.test.utils import override_settings from django.test.utils import override_settings
# Will also run default tests for IDTokens and UserInfo # Will also run default tests for IDTokens and UserInfo
...@@ -21,7 +24,7 @@ class BaseTestMixin(ModuleStoreTestCase): ...@@ -21,7 +24,7 @@ class BaseTestMixin(ModuleStoreTestCase):
def setUp(self): def setUp(self):
super(BaseTestMixin, self).setUp() super(BaseTestMixin, self).setUp()
self.course_key = CourseFactory.create(emit_signals=True).id self.course_key = CourseFactory.create(emit_signals=True).id
self.course_id = unicode(self.course_key) self.course_id = six.text_type(self.course_key)
self.user_factory = UserFactory self.user_factory = UserFactory
self.set_user(self.make_user()) self.set_user(self.make_user())
...@@ -106,7 +109,7 @@ class IDTokenTest(BaseTestMixin, IDTokenTestCase): ...@@ -106,7 +109,7 @@ class IDTokenTest(BaseTestMixin, IDTokenTestCase):
def test_course_staff_courses_with_claims(self): def test_course_staff_courses_with_claims(self):
CourseStaffRole(self.course_key).add_users(self.user) CourseStaffRole(self.course_key).add_users(self.user)
course_id = unicode(self.course_key) course_id = six.text_type(self.course_key)
nonexistent_course_id = 'some/other/course' nonexistent_course_id = 'some/other/course'
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
Test the lms/staticbook views. Test the lms/staticbook views.
""" """
from __future__ import absolute_import
import textwrap import textwrap
import mock import mock
......
...@@ -2,9 +2,11 @@ ...@@ -2,9 +2,11 @@
Views for serving static textbooks. Views for serving static textbooks.
""" """
from __future__ import absolute_import
from django.contrib.auth.decorators import login_required from django.contrib.auth.decorators import login_required
from django.views.decorators.clickjacking import xframe_options_exempt
from django.http import Http404 from django.http import Http404
from django.views.decorators.clickjacking import xframe_options_exempt
from opaque_keys.edx.keys import CourseKey from opaque_keys.edx.keys import CourseKey
from courseware.access import has_access from courseware.access import has_access
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment