incr-317 (#20608)
* run python modernize * run isort * try to fix quality * imports fix * pylint supression
This commit is contained in:
committed by
Michael Youngstrom
parent
3e92168e80
commit
c0e3ab8e15
@@ -7,6 +7,8 @@ so we can easily deprecate it once the transition from shoppingcart
|
||||
to the E-Commerce service is complete.
|
||||
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
|
||||
import datetime
|
||||
|
||||
import pytz
|
||||
|
||||
@@ -3,15 +3,18 @@
|
||||
Tests for support views.
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
import itertools
|
||||
import json
|
||||
import re
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
import ddt
|
||||
import six
|
||||
from django.contrib.auth.models import User
|
||||
from django.urls import reverse
|
||||
from django.db.models import signals
|
||||
from django.urls import reverse
|
||||
from pytz import UTC
|
||||
|
||||
from common.test.utils import disable_signal
|
||||
@@ -194,10 +197,10 @@ class SupportViewCertificatesTests(SupportViewTestCase):
|
||||
|
||||
def test_certificates_along_with_course_filter(self):
|
||||
# Check that an initial filter is passed to the JavaScript client.
|
||||
url = reverse("support:certificates") + "?user=student@example.com&course_id=" + unicode(self.course.id)
|
||||
url = reverse("support:certificates") + "?user=student@example.com&course_id=" + six.text_type(self.course.id)
|
||||
response = self.client.get(url)
|
||||
self.assertContains(response, "userFilter: 'student@example.com'")
|
||||
self.assertContains(response, "courseFilter: '" + unicode(self.course.id) + "'")
|
||||
self.assertContains(response, "courseFilter: '" + six.text_type(self.course.id) + "'")
|
||||
|
||||
|
||||
@ddt.ddt
|
||||
@@ -248,7 +251,7 @@ class SupportViewEnrollmentsTests(SharedModuleStoreTestCase, SupportViewTestCase
|
||||
'mode': CourseMode.AUDIT,
|
||||
'manual_enrollment': {},
|
||||
'user': self.student.username,
|
||||
'course_id': unicode(self.course.id),
|
||||
'course_id': six.text_type(self.course.id),
|
||||
'is_active': True,
|
||||
'verified_upgrade_deadline': None,
|
||||
}, data[0])
|
||||
@@ -282,7 +285,7 @@ class SupportViewEnrollmentsTests(SharedModuleStoreTestCase, SupportViewTestCase
|
||||
kwargs={'username_or_email': getattr(self.student, search_string_type)}
|
||||
)
|
||||
response = self.client.post(url, data={
|
||||
'course_id': unicode(self.course.id),
|
||||
'course_id': six.text_type(self.course.id),
|
||||
'old_mode': CourseMode.AUDIT,
|
||||
'new_mode': CourseMode.VERIFIED,
|
||||
'reason': 'Financial Assistance'
|
||||
@@ -318,7 +321,7 @@ class SupportViewEnrollmentsTests(SharedModuleStoreTestCase, SupportViewTestCase
|
||||
# `self` isn't available from within the DDT declaration, so
|
||||
# assign the course ID here
|
||||
if 'course_id' in data and data['course_id'] is None:
|
||||
data['course_id'] = unicode(self.course.id)
|
||||
data['course_id'] = six.text_type(self.course.id)
|
||||
response = self.client.post(self.url, data)
|
||||
self.assertEqual(response.status_code, 400)
|
||||
self.assertIsNotNone(re.match(error_message, response.content))
|
||||
@@ -403,7 +406,7 @@ class SupportViewEnrollmentsTests(SharedModuleStoreTestCase, SupportViewTestCase
|
||||
kwargs={'username_or_email': getattr(self.student, search_string_type)}
|
||||
)
|
||||
response = self.client.post(url, data={
|
||||
'course_id': unicode(self.course.id),
|
||||
'course_id': six.text_type(self.course.id),
|
||||
'old_mode': CourseMode.AUDIT,
|
||||
'new_mode': new_mode,
|
||||
'reason': 'Financial Assistance'
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
"""
|
||||
Certificate tool in the student support app.
|
||||
"""
|
||||
import urllib
|
||||
from __future__ import absolute_import
|
||||
|
||||
from six.moves.urllib.parse import unquote, quote_plus # pylint: disable=import-error
|
||||
from django.utils.decorators import method_decorator
|
||||
from django.views.generic import View
|
||||
|
||||
@@ -25,14 +26,13 @@ class CertificatesSupportView(View):
|
||||
|
||||
Most of the heavy lifting is performed client-side through API
|
||||
calls directly to the certificates app.
|
||||
|
||||
"""
|
||||
|
||||
@method_decorator(require_support_permission)
|
||||
def get(self, request):
|
||||
"""Render the certificates support view. """
|
||||
context = {
|
||||
"user_filter": urllib.unquote(urllib.quote_plus(request.GET.get("user", ""))),
|
||||
"user_filter": unquote(quote_plus(request.GET.get("user", ""))),
|
||||
"course_filter": request.GET.get("course_id", "")
|
||||
}
|
||||
return render_to_response("support/certificates.html", context)
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
"""
|
||||
Signle support contact view
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
|
||||
from django.conf import settings
|
||||
from django.http import Http404
|
||||
from django.views.generic import View
|
||||
from edxmako.shortcuts import render_to_response
|
||||
from student.models import CourseEnrollment
|
||||
|
||||
from edxmako.shortcuts import render_to_response
|
||||
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
|
||||
from openedx.features.enterprise_support import api as enterprise_api
|
||||
from student.models import CourseEnrollment
|
||||
|
||||
|
||||
class ContactUsView(View):
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
"""
|
||||
Support tool for changing and granting course entitlements
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
|
||||
from django.utils.decorators import method_decorator
|
||||
from django.views.generic import View
|
||||
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
"""
|
||||
Support tool for changing course enrollments.
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
|
||||
import six
|
||||
from django.contrib.auth.models import User
|
||||
from django.urls import reverse
|
||||
from django.db import transaction
|
||||
from django.db.models import Q
|
||||
from django.http import HttpResponseBadRequest
|
||||
from django.urls import reverse
|
||||
from django.utils.decorators import method_decorator
|
||||
from django.views.generic import View
|
||||
from opaque_keys import InvalidKeyError
|
||||
@@ -101,7 +104,7 @@ class EnrollmentSupportListView(GenericAPIView):
|
||||
return HttpResponseBadRequest(
|
||||
u'Could not find enrollment for user {username} in course {course}.'.format(
|
||||
username=username_or_email,
|
||||
course=unicode(course_key)
|
||||
course=six.text_type(course_key)
|
||||
)
|
||||
)
|
||||
try:
|
||||
|
||||
@@ -1,16 +1,19 @@
|
||||
"""
|
||||
Support tool for viewing course duration information
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
|
||||
from django.core.exceptions import ObjectDoesNotExist
|
||||
from django.utils.decorators import method_decorator
|
||||
from django.views.generic import View
|
||||
from edxmako.shortcuts import render_to_response
|
||||
from lms.djangoapps.support.decorators import require_support_permission
|
||||
from opaque_keys import InvalidKeyError
|
||||
from opaque_keys.edx.keys import CourseKey
|
||||
from openedx.features.course_duration_limits.models import CourseDurationLimitConfig
|
||||
from openedx.features.content_type_gating.models import ContentTypeGatingConfig
|
||||
|
||||
from edxmako.shortcuts import render_to_response
|
||||
from lms.djangoapps.support.decorators import require_support_permission
|
||||
from openedx.core.djangoapps.content.course_overviews.models import CourseOverview
|
||||
from openedx.features.content_type_gating.models import ContentTypeGatingConfig
|
||||
from openedx.features.course_duration_limits.models import CourseDurationLimitConfig
|
||||
|
||||
|
||||
class FeatureBasedEnrollmentsSupportView(View):
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
"""
|
||||
Index view for the support app.
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
|
||||
from django.urls import reverse_lazy
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
"""
|
||||
Support tool for disabling user accounts.
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
|
||||
from django.contrib.auth import get_user_model
|
||||
from django.urls import reverse
|
||||
from django.db.models import Q
|
||||
from django.urls import reverse
|
||||
from django.utils.decorators import method_decorator
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.views.generic import View
|
||||
|
||||
@@ -10,6 +10,8 @@ with an E-Commerce service that supports automatic refunds. Once that
|
||||
transition is complete, we can remove this view.
|
||||
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
|
||||
import logging
|
||||
|
||||
from django import forms
|
||||
@@ -81,7 +83,7 @@ class RefundForm(forms.Form):
|
||||
# this is a two-step form: first look up the data, then issue the refund.
|
||||
# first time through, set the hidden "confirmed" field to true and then redisplay the form
|
||||
# second time through, do the unenrollment/refund.
|
||||
data = dict(self.data.items())
|
||||
data = dict(list(self.data.items()))
|
||||
self.cleaned_data['confirmed'] = data['confirmed'] = 'true'
|
||||
self.data = data
|
||||
is_valid = False
|
||||
|
||||
Reference in New Issue
Block a user