Skip to content
Snippets Groups Projects
Commit 760743cc authored by Stu Young's avatar Stu Young Committed by Christie Rice
Browse files

INCR-294 Run python-modernize on lms/djangoapps/bulk_enroll (#20601)

* run python modernize

* run isort

* Fix python
parent 4cf2e855
Branches
Tags
No related merge requests found
"""
Serializers for Bulk Enrollment.
"""
from __future__ import absolute_import
from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys import CourseKey
from openedx.core.djangoapps.course_groups.cohorts import is_cohort_exists
from rest_framework import serializers
from six.moves import zip
from openedx.core.djangoapps.course_groups.cohorts import is_cohort_exists
class StringListField(serializers.ListField):
......
"""
Tests for the Bulk Enrollment views.
"""
import ddt
from __future__ import absolute_import
import json
import ddt
import six
from django.conf import settings
from django.contrib.auth.models import User
from django.core import mail
from django.urls import reverse
from django.test.utils import override_settings
from django.urls import reverse
from opaque_keys.edx.keys import CourseKey
from rest_framework.test import APIRequestFactory, APITestCase, force_authenticate
from bulk_enroll.serializers import BulkEnrollmentSerializer
from bulk_enroll.views import BulkEnrollView
from courseware.tests.helpers import LoginEnrollmentTestCase
from opaque_keys.edx.keys import CourseKey
from openedx.core.djangoapps.course_groups.cohorts import get_cohort_id
from openedx.core.djangoapps.course_groups.tests.helpers import config_course_cohorts
from openedx.core.djangoapps.site_configuration.helpers import get_value as get_site_value
from student.models import (
CourseEnrollment,
ManualEnrollmentAudit,
ENROLLED_TO_UNENROLLED,
UNENROLLED_TO_ENROLLED,
)
from student.models import ENROLLED_TO_UNENROLLED, UNENROLLED_TO_ENROLLED, CourseEnrollment, ManualEnrollmentAudit
from student.tests.factories import UserFactory
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory
......@@ -55,7 +54,7 @@ class BulkEnrollmentTest(ModuleStoreTestCase, LoginEnrollmentTestCase, APITestCa
)
self.course = CourseFactory.create()
self.course_key = unicode(self.course.id)
self.course_key = six.text_type(self.course.id)
self.enrolled_student = UserFactory(username='EnrolledStudent', first_name='Enrolled', last_name='Student')
CourseEnrollment.enroll(
self.enrolled_student,
......
"""
URLs for the Bulk Enrollment API
"""
from __future__ import absolute_import
from django.conf.urls import url
from bulk_enroll.views import BulkEnrollView
......
"""
API views for Bulk Enrollment
"""
from __future__ import absolute_import
import itertools
import json
from edx_rest_framework_extensions.auth.jwt.authentication import JwtAuthentication
from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys import CourseKey
from rest_framework import status
from rest_framework.response import Response
from rest_framework.views import APIView
......@@ -12,12 +16,7 @@ from rest_framework.views import APIView
from bulk_enroll.serializers import BulkEnrollmentSerializer
from enrollment.views import EnrollmentUserThrottle
from instructor.views.api import students_update_enrollment
from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys import CourseKey
from openedx.core.djangoapps.course_groups.cohorts import (
get_cohort_by_name,
add_user_to_cohort,
)
from openedx.core.djangoapps.course_groups.cohorts import add_user_to_cohort, get_cohort_by_name
from openedx.core.djangoapps.course_groups.models import CourseUserGroup
from openedx.core.lib.api.authentication import OAuth2Authentication
from openedx.core.lib.api.permissions import IsStaff
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment