Update quality threshold counts (#20681)

This commit is contained in:
Jeremy Bowman
2019-05-24 08:27:54 -04:00
committed by GitHub
parent fdc785bfb0
commit f9929f32b5
23 changed files with 57 additions and 102 deletions

View File

@@ -199,7 +199,7 @@ class ForcePublishCourseView(MaintenanceBaseView):
self.context['msg'] = _('Force publishing course is not supported with old mongo courses.')
log.warning(
u'Force publishing course is not supported with old mongo courses. \
%s attempted to force publish the course %s.', # pylint: disable=unicode-format-string
%s attempted to force publish the course %s.',
request.user,
course_id,
exc_info=True

View File

@@ -622,7 +622,7 @@ class SAMLProviderConfig(ProviderConfig):
'For advanced use cases, enter a JSON object with addtional configuration. '
'The tpa-saml backend supports {"requiredEntitlements": ["urn:..."]}, ' # pylint: disable=unicode-format-string
'which can be used to require the presence of a specific eduPersonEntitlement, '
'and {"extra_field_definitions": [{"name": "...", "urn": "..."},...]}, which can be ' # pylint: disable=unicode-format-string,line-too-long
'and {"extra_field_definitions": [{"name": "...", "urn": "..."},...]}, which can be ' # pylint: disable=unicode-format-string
'used to define registration form fields and the URNs that can be used to retrieve '
'the relevant values from the SAML response. Custom provider types, as selected '
'in the "Identity Provider Type" field, may make use of the information stored '
@@ -709,7 +709,7 @@ class SAMLProviderConfig(ProviderConfig):
data = SAMLProviderData.current(self.entity_id)
if not data or not data.is_valid():
log.error(
'No SAMLProviderData found for provider "%s" with entity id "%s" and IdP slug "%s". ' # pylint: disable=unicode-format-string,line-too-long
'No SAMLProviderData found for provider "%s" with entity id "%s" and IdP slug "%s". ' # pylint: disable=unicode-format-string
'Run "manage.py saml pull" to fix or debug.',
self.name, self.entity_id, self.slug
)
@@ -824,7 +824,7 @@ class LTIProviderConfig(ProviderConfig):
'tool consumer instance should know this value. '
'For increased security, you can avoid storing this in '
'your database by leaving this field blank and setting '
'SOCIAL_AUTH_LTI_CONSUMER_SECRETS = {"consumer key": "secret", ...} ' # pylint: disable=unicode-format-string,line-too-long
'SOCIAL_AUTH_LTI_CONSUMER_SECRETS = {"consumer key": "secret", ...} ' # pylint: disable=unicode-format-string
'in your instance\'s Django setttigs (or lms.auth.json)'
),
blank=True,

View File

@@ -27,9 +27,7 @@ _SETTINGS_MAP['DEFAULT_TEMPLATE_ENGINE'] = _SETTINGS_MAP['TEMPLATES'][0]
class SettingsUnitTest(testutil.TestCase):
"""Unit tests for settings management code."""
# Allow access to protected methods (or module-protected methods) under test.
# pylint: disable=protected-access
# Suppress sprurious no-member warning on fakes.
# Suppress spurious no-member warning on fakes.
# pylint: disable=no-member
def setUp(self):

View File

@@ -4,10 +4,11 @@ End-to-end tests for the LMS that utilize the
progress page.
"""
from __future__ import absolute_import
from six.moves import range
from contextlib import contextmanager
import ddt
from six.moves import range
from ...fixtures.course import CourseFixture, XBlockFixtureDesc
from ...pages.common.logout import LogoutPage
@@ -346,7 +347,7 @@ class SubsectionGradingPolicyA11yTest(SubsectionGradingPolicyBase):
# Verify that y-Axis labels are aria-hidden
self.assertEqual(['100%', 'true'], self.progress_page.y_tick_label(0))
self.assertEqual(['0%', 'true'], self.progress_page.y_tick_label(1))
self.assertEqual(['Pass 50%', 'true'], self.progress_page.y_tick_label(2)) # pylint: disable=unicode-format-string,line-too-long
self.assertEqual(['Pass 50%', 'true'], self.progress_page.y_tick_label(2)) # pylint: disable=unicode-format-string
# Verify x-Axis labels and sr-text
self._check_tick_text(0, [u'Homework 1 - Test Subsection 1 - 50% (1/2)'], u'HW 01')
@@ -407,7 +408,7 @@ class SubsectionGradingPolicyA11yTest(SubsectionGradingPolicyBase):
# Verify the overall score. The first element in the array is the sr-only text, and the
# second is the total text (including the sr-only text).
self.assertEqual(['Overall Score', 'Overall Score\n2%'], self.progress_page.graph_overall_score()) # pylint: disable=unicode-format-string,line-too-long
self.assertEqual(['Overall Score', 'Overall Score\n2%'], self.progress_page.graph_overall_score()) # pylint: disable=unicode-format-string
class ProgressPageA11yTest(ProgressPageBaseTest):

View File

@@ -227,7 +227,6 @@ autodoc_mock_imports = [
'MySQLdb',
'contracts',
'django_mysql',
'lettuce',
'pymongo',
]

View File

@@ -10,7 +10,6 @@ from django.test import TestCase
from django.test.client import Client, RequestFactory
from django.urls import reverse
from django.utils.timezone import now
from django.utils.translation import get_language
from six import text_type
from courseware.access import has_access
@@ -173,7 +172,11 @@ class LoginEnrollmentTestCase(TestCase):
self.user = self.activate_user(self.email)
self.login(self.email, self.password)
def assert_request_status_code(self, status_code, url, method="GET", **kwargs): # pylint: disable=unicode-format-string
def assert_request_status_code(self, status_code, url, method="GET", **kwargs):
"""
Make a request to the specified URL and verify that it returns the
expected status code.
"""
make_request = getattr(self.client, method.lower())
response = make_request(url, **kwargs)
self.assertEqual(
@@ -192,7 +195,7 @@ class LoginEnrollmentTestCase(TestCase):
message_list = list(messages.get_messages(response.wsgi_request))
self.assertEqual(len(message_list), 1)
self.assertIn("success", message_list[0].tags)
self.assertTrue("You have activated your account." in message_list[0].message)
self.assertIn("You have activated your account.", message_list[0].message)
# ============ User creation and login ==============
@@ -224,7 +227,7 @@ class LoginEnrollmentTestCase(TestCase):
'terms_of_service': 'true',
'honor_code': 'true',
}
resp = self.assert_request_status_code(200, url, method="POST", data=request_data)
self.assert_request_status_code(200, url, method="POST", data=request_data)
# Check both that the user is created, and inactive
user = User.objects.get(email=email)
self.assertFalse(user.is_active)

View File

@@ -607,7 +607,6 @@ def answer_entrance_exam_problem(course, request, problem, user=None, value=1, m
course,
depth=2
)
# pylint: disable=protected-access
module = get_module(
user,
request,

View File

@@ -28,7 +28,6 @@ from milestones.tests.utils import MilestonesTestCaseMixin
from mock import MagicMock, Mock, patch
from opaque_keys.edx.asides import AsideUsageKeyV2
from opaque_keys.edx.keys import CourseKey, UsageKey
from openedx.core.djangoapps.oauth_dispatch.jwt import create_jwt_for_user
from pyquery import PyQuery
from six import text_type
from web_fragments.fragment import Fragment
@@ -59,6 +58,7 @@ from lms.djangoapps.lms_xblock.field_data import LmsFieldData
from lms.djangoapps.courseware.field_overrides import OverrideFieldData
from openedx.core.djangoapps.credit.api import set_credit_requirement_status, set_credit_requirements
from openedx.core.djangoapps.credit.models import CreditCourse
from openedx.core.djangoapps.oauth_dispatch.jwt import create_jwt_for_user
from openedx.core.lib.courses import course_image_url
from openedx.core.lib.gating import api as gating_api
from openedx.core.lib.url_utils import quote_slashes
@@ -1072,12 +1072,12 @@ class TestTOC(ModuleStoreTestCase):
@ddt.ddt
@patch.dict('django.conf.settings.FEATURES', {'ENABLE_SPECIAL_EXAMS': True})
class TestProctoringRendering(SharedModuleStoreTestCase):
"""Check the Table of Contents for a course"""
@classmethod
def setUpClass(cls):
super(TestProctoringRendering, cls).setUpClass()
cls.course_key = ToyCourseFactory.create().id
"""Check the Table of Contents for a course"""
def setUp(self):
"""
Set up the initial mongo datastores
@@ -1408,6 +1408,10 @@ class TestProctoringRendering(SharedModuleStoreTestCase):
class TestGatedSubsectionRendering(SharedModuleStoreTestCase, MilestonesTestCaseMixin):
"""
Test the toc for a course is rendered correctly when there is gated content
"""
@classmethod
def setUpClass(cls):
super(TestGatedSubsectionRendering, cls).setUpClass()
@@ -1416,9 +1420,6 @@ class TestGatedSubsectionRendering(SharedModuleStoreTestCase, MilestonesTestCase
cls.course.save()
cls.store.update_item(cls.course, 0)
"""
Test the toc for a course is rendered correctly when there is gated content
"""
def setUp(self):
"""
Set up the initial test data
@@ -1538,7 +1539,8 @@ class TestHtmlModifiers(ModuleStoreTestCase):
)
result_fragment = module.render(STUDENT_VIEW)
self.assertNotIn('div class="xblock xblock-student_view xmodule_display xmodule_HtmlModule"', result_fragment.content)
self.assertNotIn('div class="xblock xblock-student_view xmodule_display xmodule_HtmlModule"',
result_fragment.content)
def test_static_link_rewrite(self):
module = render.get_module(
@@ -2163,7 +2165,7 @@ class TestXmoduleRuntimeEvent(TestSubmittingProblems):
field_data_cache = FieldDataCache.cache_for_descriptor_descendents(
self.course.id, user, self.course, depth=2)
return render.get_module( # pylint: disable=protected-access
return render.get_module(
user,
mock_request,
self.problem.location,
@@ -2236,7 +2238,7 @@ class TestRebindModule(TestSubmittingProblems):
if item is None:
item = self.lti
return render.get_module( # pylint: disable=protected-access
return render.get_module(
user,
mock_request,
item.location,

View File

@@ -1922,7 +1922,6 @@ class ProgressPageShowCorrectnessTests(ProgressPageBaseTests):
depth=2
)
self.addCleanup(set_current_request, None)
# pylint: disable=protected-access
module = get_module(
self.user,
get_mock_request(self.user),

View File

@@ -1,4 +1,4 @@
# pylint: disable=missing-docstring,relative-import
# pylint: disable=missing-docstring
# This import registers the ForumThreadViewedEventTransformer
from __future__ import absolute_import

View File

@@ -1,22 +0,0 @@
Feature: One-click unsubscribe
As a user with notifications enabled
I want to be able to unsubscribe from notifications
Scenario: Unsubscribe when not logged in
Given I am an edX user
And I am not logged in
And I have notifications enabled
When I access my unsubscribe url
Then my notifications should be disabled
And I should see "Unsubscribe Successful!" somewhere on the page
And I should see "Click here to return to your dashboard" somewhere on the page
And I should see a link to "/dashboard" with the text "here"
Scenario: Unsubscribe when logged in
Given I am a logged in user
And I have notifications enabled
When I access my unsubscribe url
Then my notifications should be disabled
And I should see "Unsubscribe Successful!" somewhere on the page
And I should see "Click here to return to your dashboard" somewhere on the page
And I should see a link to "/dashboard" with the text "here"

View File

@@ -1,26 +0,0 @@
# pylint: disable=missing-docstring,unused-argument,no-member
from django.contrib.auth.models import User
from lettuce import step, world
from lms.djangoapps.discussion.notification_prefs import NOTIFICATION_PREF_KEY
from openedx.core.djangoapps.user_api.preferences.api import get_user_preference, set_user_preference
USERNAME = "robot"
UNSUB_TOKEN = "av9E-14sAP1bVBRCPbrTHQ=="
@step(u"I have notifications enabled")
def enable_notifications(step_):
user = User.objects.get(username=USERNAME)
set_user_preference(user, NOTIFICATION_PREF_KEY, UNSUB_TOKEN)
@step(u"I access my unsubscribe url")
def access_unsubscribe_url(step_):
world.visit("/notification_prefs/unsubscribe/{0}/".format(UNSUB_TOKEN))
@step(u"my notifications should be disabled")
def notifications_should_be_disabled(step_):
user = User.objects.get(username=USERNAME)
assert not get_user_preference(user, NOTIFICATION_PREF_KEY)

View File

@@ -76,7 +76,6 @@ def answer_problem(course, request, problem, score=1, max_value=1):
course,
depth=2
)
# pylint: disable=protected-access
module = get_module(
user,
request,

View File

@@ -463,7 +463,8 @@ class ShoppingCartViewsTests(SharedModuleStoreTestCase, XssTestMixin):
resp = self.client.post(reverse('shoppingcart.views.use_code'), {'code': self.reg_code})
self.assertEqual(resp.status_code, 404)
self.assertIn(u"Code '{0}' is not valid for any course in the shopping cart.".format(self.reg_code), resp.content)
self.assertIn(u"Code '{0}' is not valid for any course in the shopping cart.".format(self.reg_code),
resp.content)
def test_cart_item_qty_greater_than_1_against_valid_reg_code(self):
course_key = text_type(self.course_key)
@@ -727,7 +728,7 @@ class ShoppingCartViewsTests(SharedModuleStoreTestCase, XssTestMixin):
self.assertEqual(resp.status_code, 200)
self.assertEquals(self.cart.orderitem_set.count(), 1)
info_log.assert_called_with(
'Coupon "%s" redemption entry removed for user "%s" for order item "%s"', # pylint: disable=unicode-format-string,line-too-long
'Coupon "%s" redemption entry removed for user "%s" for order item "%s"', # pylint: disable=unicode-format-string
self.coupon_code,
self.user,
str(reg_item.id)
@@ -740,7 +741,8 @@ class ShoppingCartViewsTests(SharedModuleStoreTestCase, XssTestMixin):
cert_item = CertificateItem.add_to_order(self.cart, self.verified_course_key, self.cost, 'honor')
self.assertEquals(self.cart.orderitem_set.count(), 2)
# Delete the discounted item, corresponding coupon redemption should be removed for that particular discounted item
# Delete the discounted item, corresponding coupon redemption
# should be removed for that particular discounted item
resp = self.client.post(reverse('shoppingcart.views.remove_item', args=[]),
{'id': cert_item.id})
@@ -1253,7 +1255,8 @@ class ShoppingCartViewsTests(SharedModuleStoreTestCase, XssTestMixin):
self.assertIn('FirstNameTesting123', resp.content)
self.assertIn('80.00', resp.content)
# check for the enrollment codes content
self.assertIn('Please send each professional one of these unique registration codes to enroll into the course.', resp.content)
self.assertIn('Please send each professional one of these unique registration codes to enroll into the course.',
resp.content)
# fetch the newly generated registration codes
course_registration_codes = CourseRegistrationCode.objects.filter(order=self.cart)
@@ -2141,7 +2144,9 @@ class CSVReportViewsTest(SharedModuleStoreTestCase):
def test_report_csv_bad_date(self):
self.login_user()
self.add_to_download_group(self.user)
response = self.client.post(reverse('payment_csv_report'), {'start_date': 'BAD', 'end_date': 'BAD', 'requested_report': 'itemized_purchase_report'})
response = self.client.post(reverse('payment_csv_report'),
{'start_date': 'BAD', 'end_date': 'BAD',
'requested_report': 'itemized_purchase_report'})
((template, context), unused_kwargs) = render_mock.call_args
self.assertEqual(template, 'shoppingcart/download_report.html')

View File

@@ -174,7 +174,7 @@ class Command(BaseCommand):
else:
log.fatal(
u"simulate_publish should be run as a CMS (Studio) " +
u"command, not %s (override with --force-lms).", # pylint: disable=unicode-format-string
u"command, not %s (override with --force-lms).",
os.environ.get('SERVICE_VARIANT')
)
sys.exit(1)

View File

@@ -178,7 +178,6 @@ class Command(BaseCommand):
if not (course_keys or options['start_date'] or options['end_date']):
raise CommandError('You must specify a filter (e.g. --courses= or --start-date)')
# pylint: disable=no-member
certs = get_recently_modified_certificates(course_keys, options['start_date'], options['end_date'])
grades = get_recently_modified_grades(course_keys, options['start_date'], options['end_date'])

View File

@@ -9,7 +9,7 @@ from django.utils.http import urlquote_plus
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
def configuration_context(request): # pylint: disable=unused-argument
def configuration_context(request):
"""
Configuration context for django templates.
"""

View File

@@ -10,15 +10,14 @@ import time
import traceback
from datetime import datetime, timedelta
import six.moves.urllib.parse
import six.moves.urllib.parse # pylint: disable=import-error
from django.contrib.auth.models import User
from django.core.management.base import BaseCommand, CommandError
from django.utils.html import escapejs
from edx_rest_api_client.client import EdxRestApiClient
from slumber.exceptions import HttpClientError, HttpServerError
from openedx.core.djangoapps.site_configuration.models import SiteConfiguration
from student.models import UserAttribute, UserProfile
from student.models import UserAttribute
from util.query import use_read_replica_if_available
HUBSPOT_API_BASE_URL = 'https://api.hubapi.com'

View File

@@ -11,7 +11,7 @@ import unittest
from ddt import ddt, file_data, data, unpack
from mock import MagicMock, mock_open, patch
from path import Path as path
from paver.easy import BuildFailure # pylint: disable=ungrouped-imports
from paver.easy import BuildFailure
import pavelib.quality
from pavelib.paver_tests.utils import fail_on_eslint

View File

@@ -9,10 +9,10 @@ import io
import json
import os
import re
import six
from datetime import datetime
from xml.sax.saxutils import quoteattr
import six
from paver.easy import BuildFailure, cmdopts, needs, sh, task
from openedx.core.djangolib.markup import HTML
@@ -789,7 +789,7 @@ def _extract_missing_pii_annotations(filename):
("report-dir=", "r", "Directory in which to put PII reports"),
])
@timed
def run_pii_check(options): # pylint: disable=unused-argument
def run_pii_check(options):
"""
Guarantee that all Django models are PII-annotated.
"""

View File

@@ -2,6 +2,6 @@
set -e
export LOWER_PYLINT_THRESHOLD=1000
export UPPER_PYLINT_THRESHOLD=2775
export ESLINT_THRESHOLD=5590
export STYLELINT_THRESHOLD=973
export UPPER_PYLINT_THRESHOLD=2200
export ESLINT_THRESHOLD=5530
export STYLELINT_THRESHOLD=880

View File

@@ -2,31 +2,31 @@
"rules": {
"javascript-concat-html": 160,
"javascript-escape": 7,
"javascript-interpolate": 27,
"javascript-jquery-append": 72,
"javascript-jquery-html": 167,
"javascript-jquery-insert-into-target": 20,
"javascript-interpolate": 26,
"javascript-jquery-append": 68,
"javascript-jquery-html": 166,
"javascript-jquery-insert-into-target": 18,
"javascript-jquery-insertion": 19,
"javascript-jquery-prepend": 7,
"mako-html-entities": 0,
"mako-invalid-html-filter": 7,
"mako-invalid-js-filter": 112,
"mako-invalid-js-filter": 107,
"mako-js-html-string": 0,
"mako-js-missing-quotes": 0,
"mako-missing-default": 144,
"mako-missing-default": 139,
"mako-multiple-page-tags": 0,
"mako-unknown-context": 0,
"mako-unparseable-expression": 0,
"mako-unwanted-html-filter": 0,
"python-close-before-format": 0,
"python-concat-html": 3,
"python-custom-escape": 8,
"python-deprecated-display-name": 14,
"python-custom-escape": 7,
"python-deprecated-display-name": 12,
"python-interpolate-html": 30,
"python-parse-error": 0,
"python-requires-html-or-text": 0,
"python-wrap-html": 142,
"python-wrap-html": 129,
"underscore-not-escaped": 493
},
"total": 1432
"total": 1398
}