diff --git a/openedx/core/djangoapps/user_authn/migrations/0001_data__add_login_service.py b/openedx/core/djangoapps/user_authn/migrations/0001_data__add_login_service.py index 8c081a2cd1..130882f4a7 100644 --- a/openedx/core/djangoapps/user_authn/migrations/0001_data__add_login_service.py +++ b/openedx/core/djangoapps/user_authn/migrations/0001_data__add_login_service.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from __future__ import unicode_literals +from __future__ import absolute_import, unicode_literals from django.conf import settings from django.db import migrations diff --git a/openedx/core/djangoapps/user_authn/tests/test_cookies.py b/openedx/core/djangoapps/user_authn/tests/test_cookies.py index 359915a4b0..edc9bfb446 100644 --- a/openedx/core/djangoapps/user_authn/tests/test_cookies.py +++ b/openedx/core/djangoapps/user_authn/tests/test_cookies.py @@ -1,20 +1,20 @@ # pylint: disable=missing-docstring -from __future__ import unicode_literals +from __future__ import absolute_import, unicode_literals -from mock import MagicMock, patch import six from django.conf import settings from django.http import HttpResponse -from django.urls import reverse from django.test import RequestFactory, TestCase - +from django.urls import reverse from edx_rest_framework_extensions.auth.jwt.decoder import jwt_decode_handler from edx_rest_framework_extensions.auth.jwt.middleware import JwtAuthCookieMiddleware +from mock import MagicMock, patch + +from openedx.core.djangoapps.user_api.accounts.utils import retrieve_last_sitewide_block_completed from openedx.core.djangoapps.user_authn import cookies as cookies_api from openedx.core.djangoapps.user_authn.tests.utils import setup_login_oauth_client -from openedx.core.djangoapps.user_api.accounts.utils import retrieve_last_sitewide_block_completed from student.models import CourseEnrollment -from student.tests.factories import UserFactory, AnonymousUserFactory +from student.tests.factories import AnonymousUserFactory, UserFactory class CookieTests(TestCase): @@ -52,7 +52,7 @@ class CookieTests(TestCase): def _copy_cookies_to_request(self, response, request): request.COOKIES = { key: val.value - for key, val in response.cookies.iteritems() + for key, val in six.iteritems(response.cookies) } def _set_use_jwt_cookie_header(self, request): diff --git a/openedx/core/djangoapps/user_authn/tests/test_exceptions.py b/openedx/core/djangoapps/user_authn/tests/test_exceptions.py index ac16d733c7..cb7c1c7caf 100644 --- a/openedx/core/djangoapps/user_authn/tests/test_exceptions.py +++ b/openedx/core/djangoapps/user_authn/tests/test_exceptions.py @@ -1,5 +1,7 @@ """ Test Authn related exception. """ +from __future__ import absolute_import + from unittest import TestCase from openedx.core.djangoapps.user_authn.exceptions import AuthFailedError diff --git a/openedx/core/djangoapps/user_authn/tests/test_utils.py b/openedx/core/djangoapps/user_authn/tests/test_utils.py index 533bed3bd0..45b5632447 100644 --- a/openedx/core/djangoapps/user_authn/tests/test_utils.py +++ b/openedx/core/djangoapps/user_authn/tests/test_utils.py @@ -1,8 +1,10 @@ """ Test User Authentication utilities """ -from collections import namedtuple -import ddt +from __future__ import absolute_import +from collections import namedtuple + +import ddt from django.test import TestCase from django.test.client import RequestFactory from django.test.utils import override_settings diff --git a/openedx/core/djangoapps/user_authn/tests/utils.py b/openedx/core/djangoapps/user_authn/tests/utils.py index c6efc9cfe6..31aaed2ea5 100644 --- a/openedx/core/djangoapps/user_authn/tests/utils.py +++ b/openedx/core/djangoapps/user_authn/tests/utils.py @@ -1,12 +1,14 @@ """ Common utilities for tests in the user_authn app. """ +from __future__ import absolute_import + from datetime import datetime, timedelta from enum import Enum from itertools import product import ddt import pytz -from mock import patch from django.conf import settings +from mock import patch from oauth2_provider import models as dot_models from rest_framework import status