INCR-114: Run python-modernize on openedx/core/djangoapps/auth_exchange (#20442)
* INCR-114: Run python-modernize on openedx/core/djangoapps/auth_exchange * isort
This commit is contained in:
committed by
Michael Youngstrom
parent
ba993c5937
commit
54de24596e
@@ -1,6 +1,8 @@
|
||||
"""
|
||||
Forms to support third-party to first-party OAuth 2.0 access token exchange
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
|
||||
import provider.constants
|
||||
from django.contrib.auth.models import User
|
||||
from django.forms import CharField
|
||||
|
||||
@@ -3,7 +3,10 @@ Mixins to facilitate testing OAuth connections to Django-OAuth-Toolkit or
|
||||
Django-OAuth2-Provider.
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
from unittest import expectedFailure
|
||||
|
||||
from django.test.client import RequestFactory
|
||||
|
||||
from openedx.core.djangoapps.oauth_dispatch import adapters
|
||||
|
||||
@@ -2,21 +2,23 @@
|
||||
"""
|
||||
Tests for OAuth token exchange forms
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
|
||||
import unittest
|
||||
|
||||
import httpretty
|
||||
import social_django.utils as social_utils
|
||||
from django.contrib.sessions.middleware import SessionMiddleware
|
||||
from django.test import TestCase
|
||||
from django.test.client import RequestFactory
|
||||
import httpretty
|
||||
from provider import scope
|
||||
from social_django.models import Partial
|
||||
import social_django.utils as social_utils
|
||||
|
||||
from third_party_auth.tests.utils import ThirdPartyOAuthTestMixinFacebook, ThirdPartyOAuthTestMixinGoogle
|
||||
|
||||
from ..forms import AccessTokenExchangeForm
|
||||
from .utils import AccessTokenExchangeTestMixin, TPA_FEATURE_ENABLED, TPA_FEATURES_KEY
|
||||
from .mixins import DOPAdapterMixin, DOTAdapterMixin
|
||||
from .utils import TPA_FEATURE_ENABLED, TPA_FEATURES_KEY, AccessTokenExchangeTestMixin
|
||||
|
||||
|
||||
class AccessTokenExchangeFormTest(AccessTokenExchangeTestMixin):
|
||||
|
||||
@@ -4,17 +4,19 @@ Tests for OAuth token exchange views
|
||||
|
||||
# pylint: disable=no-member
|
||||
|
||||
from datetime import timedelta
|
||||
from __future__ import absolute_import
|
||||
|
||||
import json
|
||||
import mock
|
||||
import unittest
|
||||
from datetime import timedelta
|
||||
|
||||
import ddt
|
||||
from django.conf import settings
|
||||
from django.urls import reverse
|
||||
from django.test import TestCase
|
||||
import httpretty
|
||||
import mock
|
||||
import provider.constants
|
||||
from django.conf import settings
|
||||
from django.test import TestCase
|
||||
from django.urls import reverse
|
||||
from provider.oauth2.models import AccessToken, Client
|
||||
from rest_framework.test import APIClient
|
||||
from social_django.models import Partial
|
||||
@@ -22,8 +24,9 @@ from social_django.models import Partial
|
||||
from openedx.core.djangoapps.oauth_dispatch.tests import factories as dot_factories
|
||||
from student.tests.factories import UserFactory
|
||||
from third_party_auth.tests.utils import ThirdPartyOAuthTestMixinFacebook, ThirdPartyOAuthTestMixinGoogle
|
||||
|
||||
from .mixins import DOPAdapterMixin, DOTAdapterMixin
|
||||
from .utils import AccessTokenExchangeTestMixin, TPA_FEATURE_ENABLED, TPA_FEATURES_KEY
|
||||
from .utils import TPA_FEATURE_ENABLED, TPA_FEATURES_KEY, AccessTokenExchangeTestMixin
|
||||
|
||||
|
||||
@ddt.ddt
|
||||
|
||||
@@ -2,12 +2,13 @@
|
||||
Test utilities for OAuth access token exchange
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
from django.conf import settings
|
||||
from social_django.models import UserSocialAuth, Partial
|
||||
from social_django.models import Partial, UserSocialAuth
|
||||
|
||||
from third_party_auth.tests.utils import ThirdPartyOAuthTestMixin
|
||||
|
||||
|
||||
TPA_FEATURES_KEY = 'ENABLE_THIRD_PARTY_AUTH'
|
||||
TPA_FEATURE_ENABLED = TPA_FEATURES_KEY in settings.FEATURES
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@ The following are currently implemented:
|
||||
|
||||
# pylint: disable=abstract-method
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
import django.contrib.auth as auth
|
||||
import social_django.utils as social_utils
|
||||
from django.conf import settings
|
||||
|
||||
Reference in New Issue
Block a user