pylint amnesty in openedx (#26364)
This commit is contained in:
@@ -11,10 +11,10 @@ from ..models import CrawlersConfig
|
||||
|
||||
|
||||
@ddt.ddt
|
||||
class CrawlersConfigTest(TestCase):
|
||||
class CrawlersConfigTest(TestCase): # lint-amnesty, pylint: disable=missing-class-docstring
|
||||
|
||||
def setUp(self):
|
||||
super(CrawlersConfigTest, self).setUp()
|
||||
super(CrawlersConfigTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
CrawlersConfig(known_user_agents='edX-downloader,crawler_foo', enabled=True).save()
|
||||
|
||||
@ddt.data(
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""
|
||||
""" # lint-amnesty, pylint: disable=django-not-configured
|
||||
edX Platform support for credentials.
|
||||
|
||||
This package will be used as a wrapper for interacting with the credentials
|
||||
|
||||
@@ -44,4 +44,4 @@ class CredentialsConfig(AppConfig):
|
||||
|
||||
def ready(self):
|
||||
# Register celery workers
|
||||
from openedx.core.djangoapps.credentials.tasks.v1 import tasks # pylint: disable=unused-variable
|
||||
from openedx.core.djangoapps.credentials.tasks.v1 import tasks # lint-amnesty, pylint: disable=unused-import, unused-variable
|
||||
|
||||
@@ -30,7 +30,7 @@ from lms.djangoapps.certificates.api import get_recently_modified_certificates
|
||||
from lms.djangoapps.grades.api import get_recently_modified_grades
|
||||
from openedx.core.djangoapps.credentials.models import NotifyCredentialsConfig
|
||||
from lms.djangoapps.certificates.models import CertificateStatuses
|
||||
from openedx.core.djangoapps.credentials.signals import handle_cert_change, send_grade_if_interesting
|
||||
from openedx.core.djangoapps.credentials.signals import handle_cert_change, send_grade_if_interesting # lint-amnesty, pylint: disable=unused-import
|
||||
from openedx.core.djangoapps.programs.signals import handle_course_cert_changed, handle_course_cert_awarded
|
||||
from openedx.core.djangoapps.site_configuration.models import SiteConfiguration
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ class TestNotifyCredentials(TestCase):
|
||||
Tests the ``notify_credentials`` management command.
|
||||
"""
|
||||
def setUp(self):
|
||||
super(TestNotifyCredentials, self).setUp()
|
||||
super(TestNotifyCredentials, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
self.user = UserFactory.create()
|
||||
self.user2 = UserFactory.create()
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"""Production settings for Credentials"""
|
||||
|
||||
|
||||
def plugin_settings(settings):
|
||||
def plugin_settings(settings): # lint-amnesty, pylint: disable=missing-function-docstring
|
||||
# Credentials Settings
|
||||
settings.CREDENTIALS_INTERNAL_SERVICE_URL = settings.ENV_TOKENS.get(
|
||||
'CREDENTIALS_INTERNAL_SERVICE_URL', settings.CREDENTIALS_INTERNAL_SERVICE_URL
|
||||
|
||||
@@ -13,7 +13,7 @@ from lms.djangoapps.grades.api import CourseGradeFactory
|
||||
from openedx.core.djangoapps.catalog.utils import get_programs
|
||||
from openedx.core.djangoapps.credentials.models import CredentialsApiConfig
|
||||
|
||||
from .helpers import is_learner_records_enabled, is_learner_records_enabled_for_org
|
||||
from .helpers import is_learner_records_enabled, is_learner_records_enabled_for_org # lint-amnesty, pylint: disable=unused-import
|
||||
from .tasks.v1.tasks import send_grade_to_credentials
|
||||
|
||||
log = getLogger(__name__)
|
||||
|
||||
@@ -6,7 +6,7 @@ This file contains celery tasks for credentials-related functionality.
|
||||
from celery import task
|
||||
from celery.utils.log import get_task_logger
|
||||
from django.conf import settings
|
||||
from django.contrib.auth.models import User
|
||||
from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user
|
||||
from edx_django_utils.monitoring import set_code_owner_attribute
|
||||
from opaque_keys.edx.keys import CourseKey
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ class TestCredentialsSignalsSendGrade(TestCase):
|
||||
""" Tests for send_grade_if_interesting, the main utility function that sends a grade """
|
||||
|
||||
def setUp(self):
|
||||
super(TestCredentialsSignalsSendGrade, self).setUp()
|
||||
super(TestCredentialsSignalsSendGrade, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
self.user = UserFactory()
|
||||
self.key = CourseKey.from_string(CourseRunFactory()['key'])
|
||||
|
||||
@@ -142,7 +142,7 @@ class TestCredentialsSignalsUtils(TestCase):
|
||||
""" Tests helper utility functions in our signal handling. """
|
||||
|
||||
def setUp(self):
|
||||
super(TestCredentialsSignalsUtils, self).setUp()
|
||||
super(TestCredentialsSignalsUtils, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
self.site = SiteFactory()
|
||||
self.course_run = CourseRunFactory()
|
||||
course = CourseFactory(course_runs=[self.course_run])
|
||||
|
||||
@@ -27,7 +27,7 @@ class TestSendGradeToCredentialTask(TestCase):
|
||||
Tests for the 'send_grade_to_credentials' method.
|
||||
"""
|
||||
def setUp(self):
|
||||
super(TestSendGradeToCredentialTask, self).setUp()
|
||||
super(TestSendGradeToCredentialTask, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
self.user = UserFactory.create(username=settings.CREDENTIALS_SERVICE_USERNAME)
|
||||
|
||||
def test_happy_path(self, mock_get_api_client):
|
||||
|
||||
@@ -24,7 +24,7 @@ class TestGetCredentials(CredentialsApiConfigMixin, CacheIsolationTestCase):
|
||||
ENABLED_CACHES = ['default']
|
||||
|
||||
def setUp(self):
|
||||
super(TestGetCredentials, self).setUp()
|
||||
super(TestGetCredentials, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
|
||||
ApplicationFactory(name=CredentialsApiConfig.OAUTH2_CLIENT_NAME)
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ def set_credit_requirements(course_key, requirements):
|
||||
try:
|
||||
credit_course = CreditCourse.get_credit_course(course_key=course_key)
|
||||
except CreditCourse.DoesNotExist:
|
||||
raise InvalidCreditCourse()
|
||||
raise InvalidCreditCourse() # lint-amnesty, pylint: disable=raise-missing-from
|
||||
|
||||
old_requirements = CreditRequirement.get_course_requirements(course_key=course_key)
|
||||
requirements_to_disable = _get_requirements_to_disable(old_requirements, requirements)
|
||||
|
||||
@@ -119,7 +119,7 @@ def check_keys_exist(shared_secret_key, provider_id):
|
||||
Raise CreditProviderNotConfigured if no key available.
|
||||
"""
|
||||
# Accounts for old way of storing provider key
|
||||
if shared_secret_key is None:
|
||||
if shared_secret_key is None: # lint-amnesty, pylint: disable=no-else-raise
|
||||
msg = u'Credit provider with ID "{provider_id}" does not have a secret key configured.'.format(
|
||||
provider_id=provider_id
|
||||
)
|
||||
@@ -212,10 +212,10 @@ def create_credit_request(course_key, provider_id, username):
|
||||
u'but the user is not eligible for credit',
|
||||
username, course_key
|
||||
)
|
||||
raise UserIsNotEligible
|
||||
raise UserIsNotEligible # lint-amnesty, pylint: disable=raise-missing-from
|
||||
except CreditProvider.DoesNotExist:
|
||||
log.error(u'Credit provider with ID "%s" has not been configured.', provider_id)
|
||||
raise CreditProviderNotConfigured
|
||||
raise CreditProviderNotConfigured # lint-amnesty, pylint: disable=raise-missing-from
|
||||
|
||||
# Check if we've enabled automatic integration with the credit
|
||||
# provider. If not, we'll show the user a link to a URL
|
||||
@@ -286,7 +286,7 @@ def create_credit_request(course_key, provider_id, username):
|
||||
msg = u'Could not retrieve final grade from the credit eligibility table for ' \
|
||||
u'user [{user_id}] in course [{course_key}].'.format(user_id=user.id, course_key=course_key)
|
||||
log.exception(msg)
|
||||
raise UserIsNotEligible(msg)
|
||||
raise UserIsNotEligible(msg) # lint-amnesty, pylint: disable=raise-missing-from
|
||||
|
||||
# Getting the students's enrollment date
|
||||
course_enrollment = CourseEnrollment.get_enrollment(user, course_key)
|
||||
@@ -382,7 +382,7 @@ def update_credit_request_status(request_uuid, provider_id, status):
|
||||
u'with this UUID is associated with the provider.'
|
||||
).format(provider_id=provider_id, request_uuid=request_uuid)
|
||||
log.warning(msg)
|
||||
raise CreditRequestNotFound(msg)
|
||||
raise CreditRequestNotFound(msg) # lint-amnesty, pylint: disable=raise-missing-from
|
||||
|
||||
|
||||
def get_credit_requests_for_user(username):
|
||||
|
||||
@@ -15,7 +15,7 @@ class CreditConfig(AppConfig):
|
||||
name = u'openedx.core.djangoapps.credit'
|
||||
|
||||
def ready(self):
|
||||
from . import signals
|
||||
from . import signals # lint-amnesty, pylint: disable=unused-import
|
||||
if settings.FEATURES.get('ENABLE_SPECIAL_EXAMS'):
|
||||
from .services import CreditService
|
||||
set_runtime_service('credit', CreditService())
|
||||
|
||||
@@ -12,7 +12,7 @@ from email.mime.multipart import MIMEMultipart
|
||||
|
||||
import six
|
||||
from django.conf import settings
|
||||
from django.contrib.auth.models import User
|
||||
from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user
|
||||
from django.contrib.staticfiles import finders
|
||||
from django.core.cache import cache
|
||||
from django.core.mail import EmailMessage, SafeMIMEText
|
||||
@@ -31,7 +31,7 @@ from xmodule.modulestore.django import modulestore
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def send_credit_notifications(username, course_key):
|
||||
def send_credit_notifications(username, course_key): # lint-amnesty, pylint: disable=too-many-statements
|
||||
"""Sends email notification to user on different phases during credit
|
||||
course e.g., credit eligibility, credit payment etc.
|
||||
"""
|
||||
|
||||
@@ -13,56 +13,56 @@ class CreditApiBadRequest(Exception):
|
||||
Could not complete a request to the credit API because
|
||||
there was a problem with the request (as opposed to an internal error).
|
||||
"""
|
||||
pass
|
||||
pass # lint-amnesty, pylint: disable=unnecessary-pass
|
||||
|
||||
|
||||
class InvalidCreditRequirements(CreditApiBadRequest):
|
||||
"""
|
||||
The requirement dictionary provided has invalid format.
|
||||
"""
|
||||
pass
|
||||
pass # lint-amnesty, pylint: disable=unnecessary-pass
|
||||
|
||||
|
||||
class InvalidCreditCourse(CreditApiBadRequest):
|
||||
"""
|
||||
The course is not configured for credit.
|
||||
"""
|
||||
pass
|
||||
pass # lint-amnesty, pylint: disable=unnecessary-pass
|
||||
|
||||
|
||||
class UserIsNotEligible(CreditApiBadRequest):
|
||||
"""
|
||||
The user has not satisfied eligibility requirements for credit.
|
||||
"""
|
||||
pass
|
||||
pass # lint-amnesty, pylint: disable=unnecessary-pass
|
||||
|
||||
|
||||
class CreditProviderNotConfigured(CreditApiBadRequest):
|
||||
"""
|
||||
The requested credit provider is not configured correctly for the course.
|
||||
"""
|
||||
pass
|
||||
pass # lint-amnesty, pylint: disable=unnecessary-pass
|
||||
|
||||
|
||||
class RequestAlreadyCompleted(CreditApiBadRequest):
|
||||
"""
|
||||
The user has already submitted a request and received a response from the credit provider.
|
||||
"""
|
||||
pass
|
||||
pass # lint-amnesty, pylint: disable=unnecessary-pass
|
||||
|
||||
|
||||
class CreditRequestNotFound(CreditApiBadRequest):
|
||||
"""
|
||||
The request does not exist.
|
||||
"""
|
||||
pass
|
||||
pass # lint-amnesty, pylint: disable=unnecessary-pass
|
||||
|
||||
|
||||
class InvalidCreditStatus(CreditApiBadRequest):
|
||||
"""
|
||||
The status is not either "approved" or "rejected".
|
||||
"""
|
||||
pass
|
||||
pass # lint-amnesty, pylint: disable=unnecessary-pass
|
||||
|
||||
|
||||
class InvalidCreditRequest(APIException):
|
||||
@@ -76,7 +76,7 @@ class UserNotEligibleException(InvalidCreditRequest):
|
||||
def __init__(self, course_key, username):
|
||||
detail = _('[{username}] is not eligible for credit for [{course_key}].').format(username=username,
|
||||
course_key=course_key)
|
||||
super(UserNotEligibleException, self).__init__(detail)
|
||||
super(UserNotEligibleException, self).__init__(detail) # lint-amnesty, pylint: disable=super-with-arguments
|
||||
|
||||
|
||||
class InvalidCourseKey(InvalidCreditRequest):
|
||||
@@ -84,4 +84,4 @@ class InvalidCourseKey(InvalidCreditRequest):
|
||||
|
||||
def __init__(self, course_key):
|
||||
detail = _('[{course_key}] is not a valid course key.').format(course_key=course_key)
|
||||
super(InvalidCourseKey, self).__init__(detail)
|
||||
super(InvalidCourseKey, self).__init__(detail) # lint-amnesty, pylint: disable=super-with-arguments
|
||||
|
||||
@@ -20,7 +20,7 @@ from django.core.validators import RegexValidator
|
||||
from django.db import IntegrityError, models, transaction
|
||||
from django.dispatch import receiver
|
||||
from django.utils.encoding import python_2_unicode_compatible
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.utils.translation import ugettext as _ # lint-amnesty, pylint: disable=unused-import
|
||||
from django.utils.translation import ugettext_lazy
|
||||
from edx_django_utils.cache import RequestCache
|
||||
from jsonfield.fields import JSONField
|
||||
|
||||
@@ -67,7 +67,7 @@ class CreditProviderCallbackSerializer(serializers.Serializer): # pylint:disabl
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
self.provider = kwargs.pop('provider', None)
|
||||
super(CreditProviderCallbackSerializer, self).__init__(**kwargs)
|
||||
super(CreditProviderCallbackSerializer, self).__init__(**kwargs) # lint-amnesty, pylint: disable=super-with-arguments
|
||||
|
||||
def validate_timestamp(self, value):
|
||||
""" Ensure the request has been received in a timely manner. """
|
||||
|
||||
@@ -6,7 +6,7 @@ Implementation of "credit" XBlock service
|
||||
import logging
|
||||
|
||||
import six
|
||||
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 ObjectDoesNotExist
|
||||
from opaque_keys.edx.keys import CourseKey
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import uuid
|
||||
import factory
|
||||
from factory.fuzzy import FuzzyText
|
||||
import pytz
|
||||
from django.contrib.auth.models import User
|
||||
from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user
|
||||
|
||||
from openedx.core.djangoapps.credit.models import (
|
||||
CreditCourse,
|
||||
|
||||
@@ -11,7 +11,7 @@ import httpretty
|
||||
import mock
|
||||
import pytz
|
||||
import six
|
||||
from django.contrib.auth.models import User
|
||||
from django.contrib.auth.models import User # lint-amnesty, pylint: disable=imported-auth-user
|
||||
from django.core import mail
|
||||
from django.db import connection
|
||||
from django.test.utils import override_settings
|
||||
@@ -160,7 +160,7 @@ class CreditApiTestBase(ModuleStoreTestCase):
|
||||
}
|
||||
|
||||
def setUp(self):
|
||||
super(CreditApiTestBase, self).setUp()
|
||||
super(CreditApiTestBase, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
self.course = CourseFactory.create(org="edx", course="DemoX", run="Demo_Course")
|
||||
self.course_key = self.course.id
|
||||
|
||||
@@ -894,7 +894,7 @@ class CreditProviderIntegrationApiTests(CreditApiTestBase):
|
||||
FINAL_GRADE = 0.95
|
||||
|
||||
def setUp(self):
|
||||
super(CreditProviderIntegrationApiTests, self).setUp()
|
||||
super(CreditProviderIntegrationApiTests, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
self.user = UserFactory(
|
||||
username=self.USER_INFO['username'],
|
||||
email=self.USER_INFO['email'],
|
||||
@@ -983,7 +983,7 @@ class CreditProviderIntegrationApiTests(CreditApiTestBase):
|
||||
self.assertEqual(parameters['final_grade'], six.text_type(self.FINAL_GRADE))
|
||||
|
||||
# Validate user information
|
||||
for key in self.USER_INFO.keys():
|
||||
for key in self.USER_INFO.keys(): # lint-amnesty, pylint: disable=consider-iterating-dictionary
|
||||
param_key = 'user_{key}'.format(key=key)
|
||||
self.assertIn(param_key, parameters)
|
||||
expected = '' if key == 'mailing_address' else self.USER_INFO[key]
|
||||
@@ -1213,7 +1213,7 @@ class CourseApiTests(CreditApiTestBase):
|
||||
"""Test Python API for course product information."""
|
||||
|
||||
def setUp(self):
|
||||
super(CourseApiTests, self).setUp()
|
||||
super(CourseApiTests, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
self.worker_user = User.objects.create_user(username=TEST_ECOMMERCE_WORKER)
|
||||
self.add_credit_course(self.course_key)
|
||||
self.credit_config = CreditConfig(cache_ttl=100, enabled=True)
|
||||
|
||||
@@ -41,7 +41,7 @@ class CreditEligibilityModelTests(TestCase):
|
||||
"""
|
||||
|
||||
def setUp(self):
|
||||
super(CreditEligibilityModelTests, self).setUp()
|
||||
super(CreditEligibilityModelTests, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
self.course_key = CourseKey.from_string("edX/DemoX/Demo_Course")
|
||||
|
||||
@ddt.data(False, True)
|
||||
@@ -105,7 +105,7 @@ class CreditRequirementStatusTests(RetirementTestCase):
|
||||
"""
|
||||
|
||||
def setUp(self):
|
||||
super(CreditRequirementStatusTests, self).setUp()
|
||||
super(CreditRequirementStatusTests, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
self.course_key = CourseKey.from_string("edX/DemoX/Demo_Course")
|
||||
self.old_username = "username"
|
||||
self.user = UserFactory(username=self.old_username)
|
||||
@@ -177,7 +177,7 @@ class CreditRequestTest(RetirementTestCase):
|
||||
"""
|
||||
|
||||
def setUp(self):
|
||||
super(CreditRequestTest, self).setUp()
|
||||
super(CreditRequestTest, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
self.user = UserFactory.create()
|
||||
self.retirement = UserRetirementStatus.create_retirement(self.user)
|
||||
self.credit_course = CreditCourse.objects.create()
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
import six
|
||||
from django.test import TestCase
|
||||
from django.test.utils import override_settings
|
||||
from django.test.utils import override_settings # lint-amnesty, pylint: disable=unused-import
|
||||
from rest_framework.exceptions import PermissionDenied
|
||||
|
||||
from openedx.core.djangoapps.credit import serializers, signature
|
||||
@@ -58,7 +58,7 @@ class CreditProviderCallbackSerializerTests(TestCase):
|
||||
|
||||
serializer = serializers.CreditProviderCallbackSerializer()
|
||||
with self.assertRaises(PermissionDenied):
|
||||
serializer._check_keys_exist_for_provider(secret_key, provider_id)
|
||||
serializer._check_keys_exist_for_provider(secret_key, provider_id) # lint-amnesty, pylint: disable=protected-access
|
||||
|
||||
def test_check_keys_exist_for_provider_list_no_keys(self):
|
||||
"""
|
||||
@@ -72,7 +72,7 @@ class CreditProviderCallbackSerializerTests(TestCase):
|
||||
|
||||
serializer = serializers.CreditProviderCallbackSerializer()
|
||||
with self.assertRaises(PermissionDenied):
|
||||
serializer._check_keys_exist_for_provider(secret_key, provider_id)
|
||||
serializer._check_keys_exist_for_provider(secret_key, provider_id) # lint-amnesty, pylint: disable=protected-access
|
||||
|
||||
def test_check_keys_exist_for_provider_list_with_key_present(self):
|
||||
"""
|
||||
@@ -84,7 +84,7 @@ class CreditProviderCallbackSerializerTests(TestCase):
|
||||
provider_id = 'asu'
|
||||
|
||||
serializer = serializers.CreditProviderCallbackSerializer()
|
||||
result = serializer._check_keys_exist_for_provider(secret_key, provider_id)
|
||||
result = serializer._check_keys_exist_for_provider(secret_key, provider_id) # lint-amnesty, pylint: disable=assignment-from-no-return, protected-access
|
||||
# No return value, so we expect successful execution to return None
|
||||
assert result is None
|
||||
|
||||
@@ -103,7 +103,7 @@ class CreditProviderCallbackSerializerTests(TestCase):
|
||||
)
|
||||
with self.assertRaises(PermissionDenied):
|
||||
# The first arg here is key we have (that doesn't match the sig)
|
||||
serializer._compare_signatures('abcd1234', provider.provider_id)
|
||||
serializer._compare_signatures('abcd1234', provider.provider_id) # lint-amnesty, pylint: disable=protected-access
|
||||
|
||||
def test_compare_signatures_list_key(self):
|
||||
"""
|
||||
@@ -122,7 +122,7 @@ class CreditProviderCallbackSerializerTests(TestCase):
|
||||
|
||||
with self.assertRaises(PermissionDenied):
|
||||
# The first arg here is the list of keys he have (that dont matcht the sig)
|
||||
serializer._compare_signatures(
|
||||
serializer._compare_signatures( # lint-amnesty, pylint: disable=protected-access
|
||||
['abcd1234', 'xyz789'],
|
||||
provider.provider_id
|
||||
)
|
||||
|
||||
@@ -22,7 +22,7 @@ class CreditServiceTests(ModuleStoreTestCase):
|
||||
"""
|
||||
|
||||
def setUp(self):
|
||||
super(CreditServiceTests, self).setUp()
|
||||
super(CreditServiceTests, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
|
||||
self.service = CreditService()
|
||||
self.course = CourseFactory.create(org='edX', number='DemoX', display_name='Demo_Course')
|
||||
@@ -202,7 +202,7 @@ class CreditServiceTests(ModuleStoreTestCase):
|
||||
)
|
||||
|
||||
# mark the grade as satisfied
|
||||
retval = self.service.set_credit_requirement_status(
|
||||
retval = self.service.set_credit_requirement_status( # lint-amnesty, pylint: disable=assignment-from-none
|
||||
self.user.id,
|
||||
self.course.id,
|
||||
'grade',
|
||||
@@ -211,7 +211,7 @@ class CreditServiceTests(ModuleStoreTestCase):
|
||||
self.assertIsNone(retval)
|
||||
|
||||
# remove the requirement status with the invalid user id
|
||||
retval = self.service.remove_credit_requirement_status(
|
||||
retval = self.service.remove_credit_requirement_status( # lint-amnesty, pylint: disable=assignment-from-none
|
||||
0,
|
||||
self.course.id,
|
||||
'grade',
|
||||
@@ -350,7 +350,7 @@ class CreditServiceTests(ModuleStoreTestCase):
|
||||
)
|
||||
|
||||
# mark the grade as satisfied
|
||||
retval = self.service.set_credit_requirement_status(
|
||||
retval = self.service.set_credit_requirement_status( # lint-amnesty, pylint: disable=assignment-from-none
|
||||
0,
|
||||
self.course.id,
|
||||
'grade',
|
||||
|
||||
@@ -39,7 +39,7 @@ class TestMinGradedRequirementStatus(ModuleStoreTestCase):
|
||||
}
|
||||
|
||||
def setUp(self):
|
||||
super(TestMinGradedRequirementStatus, self).setUp()
|
||||
super(TestMinGradedRequirementStatus, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
self.course = CourseFactory.create(
|
||||
org='Robot', number='999', display_name='Test Course'
|
||||
)
|
||||
|
||||
@@ -33,7 +33,7 @@ class TestTaskExecution(ModuleStoreTestCase):
|
||||
raise InvalidCreditRequirements
|
||||
|
||||
def setUp(self):
|
||||
super(TestTaskExecution, self).setUp()
|
||||
super(TestTaskExecution, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
|
||||
self.course = CourseFactory.create(start=datetime(2015, 3, 1))
|
||||
self.section = ItemFactory.create(parent=self.course, category='chapter', display_name='Test Section')
|
||||
|
||||
@@ -54,7 +54,7 @@ class UserMixin(object):
|
||||
list_path = None
|
||||
|
||||
def setUp(self):
|
||||
super(UserMixin, self).setUp()
|
||||
super(UserMixin, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
|
||||
# This value must be set here, as setting it outside of a method results in issues with CMS/Studio tests.
|
||||
if self.list_path:
|
||||
@@ -328,7 +328,7 @@ class CreditProviderRequestCreateViewTests(ApiTestCaseMixin, UserMixin, TestCase
|
||||
cls.provider = CreditProviderFactory()
|
||||
|
||||
def setUp(self):
|
||||
super(CreditProviderRequestCreateViewTests, self).setUp()
|
||||
super(CreditProviderRequestCreateViewTests, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
self.path = reverse('credit:create_request', kwargs={'provider_id': self.provider.provider_id})
|
||||
self.eligibility = CreditEligibilityFactory(username=self.user.username)
|
||||
|
||||
@@ -495,7 +495,7 @@ class CreditProviderCallbackViewTests(UserMixin, TestCase):
|
||||
""" Tests for CreditProviderCallbackView. """
|
||||
|
||||
def setUp(self):
|
||||
super(CreditProviderCallbackViewTests, self).setUp()
|
||||
super(CreditProviderCallbackViewTests, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
|
||||
# Authentication should NOT be required for this endpoint.
|
||||
self.client.logout()
|
||||
@@ -653,7 +653,7 @@ class CreditEligibilityViewTests(AuthMixin, UserMixin, ReadOnlyMixin, TestCase):
|
||||
view_name = 'credit:eligibility_details'
|
||||
|
||||
def setUp(self):
|
||||
super(CreditEligibilityViewTests, self).setUp()
|
||||
super(CreditEligibilityViewTests, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
self.eligibility = CreditEligibilityFactory(username=self.user.username)
|
||||
self.path = self.create_url(self.eligibility)
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ class CreditProviderViewSet(viewsets.ReadOnlyModelViewSet):
|
||||
serializer_class = CreditProviderSerializer
|
||||
|
||||
def filter_queryset(self, queryset):
|
||||
queryset = super(CreditProviderViewSet, self).filter_queryset(queryset)
|
||||
queryset = super(CreditProviderViewSet, self).filter_queryset(queryset) # lint-amnesty, pylint: disable=super-with-arguments
|
||||
|
||||
# Filter by provider ID
|
||||
provider_ids = self.request.GET.get('provider_ids', None)
|
||||
@@ -88,7 +88,7 @@ class CreditProviderRequestCreateView(views.APIView):
|
||||
try:
|
||||
course_key = CourseKey.from_string(course_key)
|
||||
except InvalidKeyError:
|
||||
raise InvalidCourseKey(course_key)
|
||||
raise InvalidCourseKey(course_key) # lint-amnesty, pylint: disable=raise-missing-from
|
||||
|
||||
# Validate the username
|
||||
username = request.data.get('username')
|
||||
@@ -103,7 +103,7 @@ class CreditProviderRequestCreateView(views.APIView):
|
||||
credit_request = create_credit_request(course_key, provider.provider_id, username)
|
||||
return Response(credit_request)
|
||||
except CreditApiBadRequest as ex:
|
||||
raise InvalidCreditRequest(text_type(ex))
|
||||
raise InvalidCreditRequest(text_type(ex)) # lint-amnesty, pylint: disable=raise-missing-from
|
||||
|
||||
|
||||
class CreditProviderCallbackView(views.APIView):
|
||||
@@ -115,7 +115,7 @@ class CreditProviderCallbackView(views.APIView):
|
||||
|
||||
@method_decorator(csrf_exempt)
|
||||
def dispatch(self, request, *args, **kwargs):
|
||||
return super(CreditProviderCallbackView, self).dispatch(request, *args, **kwargs)
|
||||
return super(CreditProviderCallbackView, self).dispatch(request, *args, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments
|
||||
|
||||
def post(self, request, provider_id):
|
||||
""" POST handler. """
|
||||
@@ -164,7 +164,7 @@ class CreditEligibilityView(generics.ListAPIView):
|
||||
try:
|
||||
course_key = CourseKey.from_string(course_key)
|
||||
except InvalidKeyError:
|
||||
raise ValidationError({'detail': '[{}] is not a valid course key.'.format(course_key)})
|
||||
raise ValidationError({'detail': '[{}] is not a valid course key.'.format(course_key)}) # lint-amnesty, pylint: disable=raise-missing-from
|
||||
return queryset.filter(
|
||||
username=username,
|
||||
course__course_key=course_key,
|
||||
@@ -194,7 +194,7 @@ class CreditCourseViewSet(PutAsCreateMixin, mixins.UpdateModelMixin, viewsets.Re
|
||||
# SessionAuthentication will enforce CSRF protection.
|
||||
@method_decorator(csrf_exempt)
|
||||
def dispatch(self, request, *args, **kwargs):
|
||||
return super(CreditCourseViewSet, self).dispatch(request, *args, **kwargs)
|
||||
return super(CreditCourseViewSet, self).dispatch(request, *args, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments
|
||||
|
||||
def get_object(self):
|
||||
# Convert the serialized course key into a CourseKey instance
|
||||
@@ -203,4 +203,4 @@ class CreditCourseViewSet(PutAsCreateMixin, mixins.UpdateModelMixin, viewsets.Re
|
||||
if course_key is not None:
|
||||
self.kwargs[self.lookup_field] = CourseKey.from_string(course_key)
|
||||
|
||||
return super(CreditCourseViewSet, self).get_object()
|
||||
return super(CreditCourseViewSet, self).get_object() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""
|
||||
""" # lint-amnesty, pylint: disable=django-not-configured
|
||||
Language Translation Dark Launching
|
||||
===================================
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ class DarkLangMiddlewareTests(CacheIsolationTestCase):
|
||||
Tests of DarkLangMiddleware
|
||||
"""
|
||||
def setUp(self):
|
||||
super(DarkLangMiddlewareTests, self).setUp()
|
||||
super(DarkLangMiddlewareTests, self).setUp() # lint-amnesty, pylint: disable=super-with-arguments
|
||||
self.user = UserFactory.build(username='test', email='test@edx.org', password='test_password')
|
||||
self.user.save()
|
||||
self.client = Client()
|
||||
@@ -246,7 +246,7 @@ class DarkLangMiddlewareTests(CacheIsolationTestCase):
|
||||
"""
|
||||
Sends a post request to set the preview language
|
||||
"""
|
||||
return self.client.post('/update_lang/', {'preview_language': preview_language, 'action': 'set_preview_language'})
|
||||
return self.client.post('/update_lang/', {'preview_language': preview_language, 'action': 'set_preview_language'}) # lint-amnesty, pylint: disable=line-too-long
|
||||
|
||||
def _post_clear_preview_lang(self):
|
||||
"""
|
||||
|
||||
@@ -30,7 +30,7 @@ class PreviewLanguageFragmentView(EdxFragmentView):
|
||||
POST - updates or clears the setting to the given dark language
|
||||
"""
|
||||
|
||||
def render_to_fragment(self, request, course_id=None, **kwargs):
|
||||
def render_to_fragment(self, request, course_id=None, **kwargs): # lint-amnesty, pylint: disable=arguments-differ, unused-argument
|
||||
"""
|
||||
Renders the language preview view as a fragment.
|
||||
"""
|
||||
@@ -58,10 +58,10 @@ class PreviewLanguageFragmentView(EdxFragmentView):
|
||||
"""
|
||||
if not self._user_can_preview_languages(request.user):
|
||||
raise Http404
|
||||
return super(PreviewLanguageFragmentView, self).get(request, *args, **kwargs)
|
||||
return super(PreviewLanguageFragmentView, self).get(request, *args, **kwargs) # lint-amnesty, pylint: disable=super-with-arguments
|
||||
|
||||
@method_decorator(login_required)
|
||||
def post(self, request, **kwargs):
|
||||
def post(self, request, **kwargs): # lint-amnesty, pylint: disable=unused-argument
|
||||
"""
|
||||
Accept requests to update the preview language.
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user