diff --git a/openedx/core/djangoapps/user_api/course_tag/api.py b/openedx/core/djangoapps/user_api/course_tag/api.py index ab58f43955..96954913df 100644 --- a/openedx/core/djangoapps/user_api/course_tag/api.py +++ b/openedx/core/djangoapps/user_api/course_tag/api.py @@ -7,8 +7,12 @@ Stores global metadata using the UserPreference model, and per-course metadata u UserCourseTag model. """ +from __future__ import absolute_import + from collections import defaultdict + from openedx.core.lib.cache_utils import get_cache + from ..models import UserCourseTag # Scopes diff --git a/openedx/core/djangoapps/user_api/course_tag/tests/test_api.py b/openedx/core/djangoapps/user_api/course_tag/tests/test_api.py index 30c28fba81..94cf76b11f 100644 --- a/openedx/core/djangoapps/user_api/course_tag/tests/test_api.py +++ b/openedx/core/djangoapps/user_api/course_tag/tests/test_api.py @@ -1,12 +1,14 @@ """ Test the user course tag API. """ -from django.test import TestCase +from __future__ import absolute_import -from student.tests.factories import UserFactory -from openedx.core.djangoapps.user_api.course_tag import api as course_tag_api +from django.test import TestCase from opaque_keys.edx.locator import CourseLocator +from openedx.core.djangoapps.user_api.course_tag import api as course_tag_api +from student.tests.factories import UserFactory + class TestCourseTagAPI(TestCase): """ diff --git a/openedx/core/djangoapps/user_api/migrations/0001_initial.py b/openedx/core/djangoapps/user_api/migrations/0001_initial.py index 79b4e14337..984b22134b 100644 --- a/openedx/core/djangoapps/user_api/migrations/0001_initial.py +++ b/openedx/core/djangoapps/user_api/migrations/0001_initial.py @@ -1,11 +1,11 @@ # -*- coding: utf-8 -*- -from __future__ import unicode_literals +from __future__ import absolute_import, unicode_literals -from django.db import migrations, models -import django.utils.timezone -from django.conf import settings -import model_utils.fields import django.core.validators +import django.utils.timezone +import model_utils.fields +from django.conf import settings +from django.db import migrations, models from opaque_keys.edx.django.models import CourseKeyField diff --git a/openedx/core/djangoapps/user_api/migrations/0002_retirementstate_userretirementstatus.py b/openedx/core/djangoapps/user_api/migrations/0002_retirementstate_userretirementstatus.py index 516fc960f6..34613c1ea8 100644 --- a/openedx/core/djangoapps/user_api/migrations/0002_retirementstate_userretirementstatus.py +++ b/openedx/core/djangoapps/user_api/migrations/0002_retirementstate_userretirementstatus.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- # Generated by Django 1.11.12 on 2018-04-19 17:55 -from __future__ import unicode_literals +from __future__ import absolute_import, unicode_literals -from django.conf import settings -from django.db import migrations, models import django.db.models.deletion import django.utils.timezone import model_utils.fields +from django.conf import settings +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/openedx/core/djangoapps/user_api/migrations/0003_userretirementrequest.py b/openedx/core/djangoapps/user_api/migrations/0003_userretirementrequest.py index c366d1b5b7..7d014dee91 100644 --- a/openedx/core/djangoapps/user_api/migrations/0003_userretirementrequest.py +++ b/openedx/core/djangoapps/user_api/migrations/0003_userretirementrequest.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- # Generated by Django 1.11.13 on 2018-05-14 20:37 -from __future__ import unicode_literals +from __future__ import absolute_import, unicode_literals -from django.conf import settings -from django.db import migrations, models import django.db.models.deletion import django.utils.timezone import model_utils.fields +from django.conf import settings +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/openedx/core/djangoapps/user_api/migrations/0004_userretirementpartnerreportingstatus.py b/openedx/core/djangoapps/user_api/migrations/0004_userretirementpartnerreportingstatus.py index 43456e5e99..5cf194e39e 100644 --- a/openedx/core/djangoapps/user_api/migrations/0004_userretirementpartnerreportingstatus.py +++ b/openedx/core/djangoapps/user_api/migrations/0004_userretirementpartnerreportingstatus.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- # Generated by Django 1.11.13 on 2018-06-13 20:54 -from __future__ import unicode_literals +from __future__ import absolute_import, unicode_literals -from django.conf import settings -from django.db import migrations, models import django.db.models.deletion import django.utils.timezone import model_utils.fields +from django.conf import settings +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/openedx/core/djangoapps/user_api/validation/tests/test_views.py b/openedx/core/djangoapps/user_api/validation/tests/test_views.py index 8046fa57a3..cb758a89bf 100644 --- a/openedx/core/djangoapps/user_api/validation/tests/test_views.py +++ b/openedx/core/djangoapps/user_api/validation/tests/test_views.py @@ -3,19 +3,22 @@ Tests for an API endpoint for client-side user data validation. """ +from __future__ import absolute_import + import unittest import ddt from django.conf import settings from django.contrib.auth.models import User -from django.urls import reverse from django.test.utils import override_settings +from django.urls import reverse from six import text_type +from six.moves import range from openedx.core.djangoapps.user_api import accounts from openedx.core.djangoapps.user_api.accounts.tests import testutils -from openedx.core.lib.api import test_utils from openedx.core.djangoapps.user_api.validation.views import RegistrationValidationThrottle +from openedx.core.lib.api import test_utils from util.password_policy_validators import DEFAULT_MAX_PASSWORD_LENGTH diff --git a/openedx/core/djangoapps/user_api/validation/views.py b/openedx/core/djangoapps/user_api/validation/views.py index 16812159a1..ecb0df1781 100644 --- a/openedx/core/djangoapps/user_api/validation/views.py +++ b/openedx/core/djangoapps/user_api/validation/views.py @@ -3,21 +3,23 @@ An API for client-side validation of (potential) user data. """ +from __future__ import absolute_import + +from ipware.ip import get_ip from rest_framework.response import Response -from rest_framework.views import APIView from rest_framework.throttling import AnonRateThrottle +from rest_framework.views import APIView from openedx.core.djangoapps.user_api.accounts.api import ( - get_email_validation_error, - get_email_existence_validation_error, get_confirm_email_validation_error, get_country_validation_error, + get_email_existence_validation_error, + get_email_validation_error, get_name_validation_error, get_password_validation_error, - get_username_validation_error, - get_username_existence_validation_error + get_username_existence_validation_error, + get_username_validation_error ) -from ipware.ip import get_ip class RegistrationValidationThrottle(AnonRateThrottle):