@@ -1,3 +1,4 @@
|
||||
"""
|
||||
# lint-amnesty, pylint: disable=django-not-configured
|
||||
Initialization app for the LMS
|
||||
"""
|
||||
|
||||
@@ -24,7 +24,7 @@ class LmsFieldData(SplitFieldData):
|
||||
self._authored_data = authored_data
|
||||
self._student_data = student_data
|
||||
|
||||
super(LmsFieldData, self).__init__({
|
||||
super(LmsFieldData, self).__init__({ # lint-amnesty, pylint: disable=super-with-arguments
|
||||
Scope.content: authored_data,
|
||||
Scope.settings: authored_data,
|
||||
Scope.parent: authored_data,
|
||||
|
||||
@@ -198,7 +198,7 @@ class LmsBlockMixin(XBlockMixin):
|
||||
Validates the state of this xblock instance.
|
||||
"""
|
||||
_ = self.runtime.service(self, "i18n").ugettext
|
||||
validation = super(LmsBlockMixin, self).validate()
|
||||
validation = super(LmsBlockMixin, self).validate() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
has_invalid_user_partitions = False
|
||||
has_invalid_groups = False
|
||||
block_is_unit = is_unit(self)
|
||||
@@ -253,7 +253,7 @@ class LmsBlockMixin(XBlockMixin):
|
||||
Publish completion data from the front end.
|
||||
"""
|
||||
completion_service = self.runtime.service(self, 'completion')
|
||||
if completion_service is None:
|
||||
if completion_service is None: # lint-amnesty, pylint: disable=no-else-raise
|
||||
raise JsonHandlerError(500, u"No completion service found")
|
||||
elif not completion_service.completion_tracking_enabled():
|
||||
raise JsonHandlerError(404, u"Completion tracking is not enabled and API calls are unexpected")
|
||||
|
||||
@@ -166,9 +166,9 @@ class LmsModuleSystem(ModuleSystem): # pylint: disable=abstract-method
|
||||
services['teams'] = TeamsService()
|
||||
services['teams_configuration'] = TeamsConfigurationService()
|
||||
services['call_to_action'] = CallToActionService()
|
||||
super(LmsModuleSystem, self).__init__(**kwargs)
|
||||
super(LmsModuleSystem, self).__init__(**kwargs) # lint-amnesty, pylint: disable=super-with-arguments
|
||||
|
||||
def handler_url(self, *args, **kwargs):
|
||||
def handler_url(self, *args, **kwargs): # lint-amnesty, pylint: disable=signature-differs
|
||||
"""
|
||||
Implement the XBlock runtime handler_url interface.
|
||||
|
||||
@@ -244,6 +244,6 @@ class LmsModuleSystem(ModuleSystem): # pylint: disable=abstract-method
|
||||
# (see https://openedx.atlassian.net/browse/TE-811)
|
||||
return [
|
||||
aside_type
|
||||
for aside_type in super(LmsModuleSystem, self).applicable_aside_types(block)
|
||||
for aside_type in super(LmsModuleSystem, self).applicable_aside_types(block) # lint-amnesty, pylint: disable=super-with-arguments
|
||||
if aside_type != 'acid_aside'
|
||||
]
|
||||
|
||||
@@ -29,19 +29,19 @@ class BlockMock(Mock):
|
||||
"""
|
||||
A test handler method.
|
||||
"""
|
||||
pass
|
||||
pass # lint-amnesty, pylint: disable=unnecessary-pass
|
||||
|
||||
def handler1(self, _context):
|
||||
"""
|
||||
A test handler method.
|
||||
"""
|
||||
pass
|
||||
pass # lint-amnesty, pylint: disable=unnecessary-pass
|
||||
|
||||
def handler_a(self, _context):
|
||||
"""
|
||||
A test handler method.
|
||||
"""
|
||||
pass
|
||||
pass # lint-amnesty, pylint: disable=unnecessary-pass
|
||||
|
||||
@property
|
||||
def location(self):
|
||||
@@ -54,7 +54,7 @@ class TestHandlerUrl(TestCase):
|
||||
"""Test the LMS handler_url"""
|
||||
|
||||
def setUp(self):
|
||||
super(TestHandlerUrl, self).setUp()
|
||||
super(TestHandlerUrl, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
self.block = BlockMock(name='block', scope_ids=ScopeIds(None, None, None, 'dummy'))
|
||||
self.course_key = CourseLocator("org", "course", "run")
|
||||
self.runtime = LmsModuleSystem(
|
||||
@@ -119,7 +119,7 @@ class TestUserServiceAPI(TestCase):
|
||||
"""Test the user service interface"""
|
||||
|
||||
def setUp(self):
|
||||
super(TestUserServiceAPI, self).setUp()
|
||||
super(TestUserServiceAPI, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
self.course_id = CourseLocator("org", "course", "run")
|
||||
self.user = UserFactory.create()
|
||||
|
||||
@@ -169,7 +169,7 @@ class TestBadgingService(ModuleStoreTestCase):
|
||||
"""Test the badging service interface"""
|
||||
|
||||
def setUp(self):
|
||||
super(TestBadgingService, self).setUp()
|
||||
super(TestBadgingService, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
self.course_id = CourseKey.from_string('course-v1:org+course+run')
|
||||
|
||||
self.mock_block = Mock()
|
||||
@@ -235,7 +235,7 @@ class TestI18nService(ModuleStoreTestCase):
|
||||
|
||||
def setUp(self):
|
||||
""" Setting up tests """
|
||||
super(TestI18nService, self).setUp()
|
||||
super(TestI18nService, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
self.course = CourseFactory.create()
|
||||
self.test_language = 'dummy language'
|
||||
self.runtime = LmsModuleSystem(
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""
|
||||
""" # lint-amnesty, pylint: disable=django-not-configured
|
||||
The LTI Provider app gives a way to launch edX content via a campus LMS
|
||||
platform. LTI is a standard protocol for connecting educational tools, defined
|
||||
by IMS:
|
||||
|
||||
@@ -64,7 +64,7 @@ class CommandExecutionTestCase(SharedModuleStoreTestCase):
|
||||
cls.lti_block = u'block-v1:edX+lti_provider+3000+type@chapter+block@chapter_2'
|
||||
|
||||
def setUp(self):
|
||||
super(CommandExecutionTestCase, self).setUp()
|
||||
super(CommandExecutionTestCase, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
self.user = UserFactory()
|
||||
self.user2 = UserFactory(username=u'anotheruser')
|
||||
self.client.login(username=self.user.username, password=u'test')
|
||||
|
||||
@@ -12,7 +12,7 @@ changes. To do that,
|
||||
|
||||
import logging
|
||||
|
||||
from django.contrib.auth.models import User
|
||||
from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user
|
||||
from django.db import models
|
||||
from opaque_keys.edx.django.models import CourseKeyField, UsageKeyField
|
||||
|
||||
|
||||
@@ -71,23 +71,23 @@ def generate_replace_result_xml(result_sourcedid, score):
|
||||
"""
|
||||
# Pylint doesn't recognize members in the LXML module
|
||||
elem = ElementMaker(nsmap={None: 'http://www.imsglobal.org/services/ltiv1p1/xsd/imsoms_v1p0'})
|
||||
xml = elem.imsx_POXEnvelopeRequest(
|
||||
elem.imsx_POXHeader(
|
||||
elem.imsx_POXRequestHeaderInfo(
|
||||
elem.imsx_version('V1.0'),
|
||||
elem.imsx_messageIdentifier(str(uuid.uuid4()))
|
||||
xml = elem.imsx_POXEnvelopeRequest( # lint-amnesty, pylint: disable=no-member
|
||||
elem.imsx_POXHeader( # lint-amnesty, pylint: disable=no-member
|
||||
elem.imsx_POXRequestHeaderInfo( # lint-amnesty, pylint: disable=no-member
|
||||
elem.imsx_version('V1.0'), # lint-amnesty, pylint: disable=no-member
|
||||
elem.imsx_messageIdentifier(str(uuid.uuid4())) # lint-amnesty, pylint: disable=no-member
|
||||
)
|
||||
),
|
||||
elem.imsx_POXBody(
|
||||
elem.replaceResultRequest(
|
||||
elem.resultRecord(
|
||||
elem.sourcedGUID(
|
||||
elem.sourcedId(result_sourcedid)
|
||||
elem.imsx_POXBody( # lint-amnesty, pylint: disable=no-member
|
||||
elem.replaceResultRequest( # lint-amnesty, pylint: disable=no-member
|
||||
elem.resultRecord( # lint-amnesty, pylint: disable=no-member
|
||||
elem.sourcedGUID( # lint-amnesty, pylint: disable=no-member
|
||||
elem.sourcedId(result_sourcedid) # lint-amnesty, pylint: disable=no-member
|
||||
),
|
||||
elem.result(
|
||||
elem.resultScore(
|
||||
elem.language('en'),
|
||||
elem.textString(str(score))
|
||||
elem.result( # lint-amnesty, pylint: disable=no-member
|
||||
elem.resultScore( # lint-amnesty, pylint: disable=no-member
|
||||
elem.language('en'), # lint-amnesty, pylint: disable=no-member
|
||||
elem.textString(str(score)) # lint-amnesty, pylint: disable=no-member
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -18,7 +18,7 @@ class SignatureValidator(RequestValidator):
|
||||
"""
|
||||
|
||||
def __init__(self, lti_consumer):
|
||||
super(SignatureValidator, self).__init__()
|
||||
super(SignatureValidator, self).__init__() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
self.endpoint = SignatureOnlyEndpoint(self)
|
||||
self.lti_consumer = lti_consumer
|
||||
|
||||
@@ -31,7 +31,7 @@ class SignatureValidator(RequestValidator):
|
||||
# on the platform.
|
||||
enforce_ssl = False
|
||||
|
||||
def check_client_key(self, key):
|
||||
def check_client_key(self, key): # lint-amnesty, pylint: disable=arguments-differ
|
||||
"""
|
||||
Verify that the key supplied by the LTI consumer is valid for an LTI
|
||||
launch. This method is only concerned with the structure of the key;
|
||||
@@ -141,13 +141,13 @@ class SignatureValidator(RequestValidator):
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def dummy_access_token(self):
|
||||
def dummy_access_token(self): # lint-amnesty, pylint: disable=invalid-overridden-method
|
||||
"""
|
||||
Unused abstract method from super class. See documentation in RequestValidator
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def dummy_client(self):
|
||||
def dummy_client(self): # lint-amnesty, pylint: disable=invalid-overridden-method
|
||||
"""
|
||||
Unused abstract method from super class. See documentation in RequestValidator
|
||||
"""
|
||||
@@ -172,7 +172,7 @@ class SignatureValidator(RequestValidator):
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def dummy_request_token(self):
|
||||
def dummy_request_token(self): # lint-amnesty, pylint: disable=invalid-overridden-method
|
||||
"""
|
||||
Unused abstract method from super class. See documentation in RequestValidator
|
||||
"""
|
||||
|
||||
@@ -5,7 +5,7 @@ Asynchronous tasks for the LTI provider app.
|
||||
|
||||
import logging
|
||||
|
||||
from django.contrib.auth.models import User
|
||||
from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user
|
||||
from opaque_keys.edx.keys import CourseKey
|
||||
|
||||
import lms.djangoapps.lti_provider.outcomes as outcomes
|
||||
|
||||
@@ -21,7 +21,7 @@ class StoreOutcomeParametersTest(TestCase):
|
||||
"""
|
||||
|
||||
def setUp(self):
|
||||
super(StoreOutcomeParametersTest, self).setUp()
|
||||
super(StoreOutcomeParametersTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
self.user = UserFactory.create()
|
||||
self.course_key = CourseLocator(
|
||||
org='some_org',
|
||||
@@ -135,7 +135,7 @@ class SignAndSendReplaceResultTest(TestCase):
|
||||
"""
|
||||
|
||||
def setUp(self):
|
||||
super(SignAndSendReplaceResultTest, self).setUp()
|
||||
super(SignAndSendReplaceResultTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
self.course_key = CourseLocator(
|
||||
org='some_org',
|
||||
course='some_course',
|
||||
@@ -298,7 +298,7 @@ class TestAssignmentsForProblem(ModuleStoreTestCase):
|
||||
"""
|
||||
|
||||
def setUp(self):
|
||||
super(TestAssignmentsForProblem, self).setUp()
|
||||
super(TestAssignmentsForProblem, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
self.user = UserFactory.create()
|
||||
self.user_id = self.user.id
|
||||
self.outcome_service = self.create_outcome_service('outcomes')
|
||||
|
||||
@@ -30,7 +30,7 @@ class ClientKeyValidatorTest(TestCase):
|
||||
"""
|
||||
|
||||
def setUp(self):
|
||||
super(ClientKeyValidatorTest, self).setUp()
|
||||
super(ClientKeyValidatorTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
self.lti_consumer = get_lti_consumer()
|
||||
|
||||
def test_valid_client_key(self):
|
||||
@@ -60,7 +60,7 @@ class NonceValidatorTest(TestCase):
|
||||
"""
|
||||
|
||||
def setUp(self):
|
||||
super(NonceValidatorTest, self).setUp()
|
||||
super(NonceValidatorTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
self.lti_consumer = get_lti_consumer()
|
||||
|
||||
def test_valid_nonce(self):
|
||||
@@ -91,7 +91,7 @@ class SignatureValidatorTest(TestCase):
|
||||
"""
|
||||
|
||||
def setUp(self):
|
||||
super(SignatureValidatorTest, self).setUp()
|
||||
super(SignatureValidatorTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
self.lti_consumer = get_lti_consumer()
|
||||
|
||||
def test_get_existing_client_secret(self):
|
||||
|
||||
@@ -19,7 +19,7 @@ class BaseOutcomeTest(TestCase):
|
||||
Super type for tests of both the leaf and composite outcome celery tasks.
|
||||
"""
|
||||
def setUp(self):
|
||||
super(BaseOutcomeTest, self).setUp()
|
||||
super(BaseOutcomeTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
self.course_key = CourseLocator(
|
||||
org='some_org',
|
||||
course='some_course',
|
||||
@@ -96,7 +96,7 @@ class SendCompositeOutcomeTest(BaseOutcomeTest):
|
||||
"""
|
||||
|
||||
def setUp(self):
|
||||
super(SendCompositeOutcomeTest, self).setUp()
|
||||
super(SendCompositeOutcomeTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
self.descriptor = MagicMock()
|
||||
self.descriptor.location = BlockUsageLocator(
|
||||
course_key=self.course_key,
|
||||
|
||||
@@ -5,7 +5,7 @@ Tests for the LTI user management functionality
|
||||
|
||||
import string
|
||||
|
||||
from django.contrib.auth.models import User
|
||||
from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user
|
||||
from django.core.exceptions import PermissionDenied
|
||||
from django.test import TestCase
|
||||
from django.test.client import RequestFactory
|
||||
@@ -14,7 +14,7 @@ from six.moves import range
|
||||
|
||||
from .. import users
|
||||
from ..models import LtiConsumer, LtiUser
|
||||
from common.djangoapps.student.tests.factories import UserFactory
|
||||
from common.djangoapps.student.tests.factories import UserFactory # lint-amnesty, pylint: disable=wrong-import-order
|
||||
|
||||
|
||||
class UserManagementHelperTest(TestCase):
|
||||
@@ -23,7 +23,7 @@ class UserManagementHelperTest(TestCase):
|
||||
"""
|
||||
|
||||
def setUp(self):
|
||||
super(UserManagementHelperTest, self).setUp()
|
||||
super(UserManagementHelperTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
self.request = RequestFactory().post('/')
|
||||
self.old_user = UserFactory.create()
|
||||
self.new_user = UserFactory.create()
|
||||
@@ -66,7 +66,7 @@ class UserManagementHelperTest(TestCase):
|
||||
username = users.generate_random_edx_username()
|
||||
self.assertLessEqual(len(username), 30, 'Username too long')
|
||||
# Check that the username contains only allowable characters
|
||||
for char in range(len(username)):
|
||||
for char in range(len(username)): # lint-amnesty, pylint: disable=consider-using-enumerate
|
||||
self.assertIn(
|
||||
username[char], string.ascii_letters + string.digits,
|
||||
u"Username has forbidden character '{}'".format(username[char])
|
||||
@@ -81,7 +81,7 @@ class AuthenticateLtiUserTest(TestCase):
|
||||
"""
|
||||
|
||||
def setUp(self):
|
||||
super(AuthenticateLtiUserTest, self).setUp()
|
||||
super(AuthenticateLtiUserTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
self.lti_consumer = LtiConsumer(
|
||||
consumer_name='TestConsumer',
|
||||
consumer_key='TestKey',
|
||||
@@ -148,7 +148,7 @@ class CreateLtiUserTest(TestCase):
|
||||
"""
|
||||
|
||||
def setUp(self):
|
||||
super(CreateLtiUserTest, self).setUp()
|
||||
super(CreateLtiUserTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
self.lti_consumer = LtiConsumer(
|
||||
consumer_name='TestConsumer',
|
||||
consumer_key='TestKey',
|
||||
@@ -185,7 +185,7 @@ class LtiBackendTest(TestCase):
|
||||
"""
|
||||
|
||||
def setUp(self):
|
||||
super(LtiBackendTest, self).setUp()
|
||||
super(LtiBackendTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
self.edx_user = UserFactory.create()
|
||||
self.edx_user.save()
|
||||
self.lti_consumer = LtiConsumer(
|
||||
|
||||
@@ -68,7 +68,7 @@ class LtiTestMixin(object):
|
||||
"""
|
||||
@patch.dict('django.conf.settings.FEATURES', {'ENABLE_LTI_PROVIDER': True})
|
||||
def setUp(self):
|
||||
super(LtiTestMixin, self).setUp()
|
||||
super(LtiTestMixin, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
# Always accept the OAuth signature
|
||||
self.mock_verify = MagicMock(return_value=True)
|
||||
patcher = patch('lms.djangoapps.lti_provider.signature_validator.SignatureValidator.verify', self.mock_verify)
|
||||
|
||||
@@ -10,7 +10,7 @@ import uuid
|
||||
|
||||
from django.conf import settings
|
||||
from django.contrib.auth import authenticate, login
|
||||
from django.contrib.auth.models import User
|
||||
from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user
|
||||
from django.core.exceptions import PermissionDenied
|
||||
from django.db import IntegrityError, transaction
|
||||
from six.moves import range
|
||||
|
||||
@@ -83,7 +83,7 @@ def lti_launch(request, course_id, usage_id):
|
||||
usage_id,
|
||||
request
|
||||
)
|
||||
raise Http404()
|
||||
raise Http404() # lint-amnesty, pylint: disable=raise-missing-from
|
||||
params['course_key'] = course_key
|
||||
params['usage_key'] = usage_key
|
||||
|
||||
|
||||
Reference in New Issue
Block a user