ran python-modernize and isort on files mentioned in INCR-396
This commit is contained in:
@@ -1,12 +1,14 @@
|
||||
"""
|
||||
Tests third_party_auth admin views
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
|
||||
import unittest
|
||||
|
||||
from django.contrib.admin.sites import AdminSite
|
||||
from django.core.files.uploadedfile import SimpleUploadedFile
|
||||
from django.urls import reverse
|
||||
from django.forms import models
|
||||
from django.urls import reverse
|
||||
|
||||
from student.tests.factories import UserFactory
|
||||
from third_party_auth.admin import OAuth2ProviderConfigAdmin
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
Unit tests for third_party_auth LTI auth providers
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
import unittest
|
||||
|
||||
from oauthlib.common import Request
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
"""Unit tests for settings.py."""
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
import unittest
|
||||
|
||||
from third_party_auth import provider, settings
|
||||
from third_party_auth.tests import testutil
|
||||
|
||||
|
||||
_ORIGINAL_AUTHENTICATION_BACKENDS = ['first_authentication_backend']
|
||||
_ORIGINAL_INSTALLED_APPS = ['first_installed_app']
|
||||
_ORIGINAL_MIDDLEWARE_CLASSES = ['first_middleware_class']
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
"""
|
||||
Tests for third_party_auth utility functions.
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
|
||||
import unittest
|
||||
|
||||
from django.conf import settings
|
||||
|
||||
from student.tests.factories import UserFactory
|
||||
from third_party_auth.tests.testutil import TestCase
|
||||
from third_party_auth.utils import user_exists
|
||||
from student.tests.factories import UserFactory
|
||||
|
||||
|
||||
@unittest.skipUnless(settings.ROOT_URLCONF == 'lms.urls', 'Test only valid in lms')
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
Test the views served by third_party_auth.
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
import unittest
|
||||
|
||||
import ddt
|
||||
|
||||
@@ -4,11 +4,14 @@ Utilities for writing third_party_auth tests.
|
||||
Used by Django and non-Django tests; must not have Django deps.
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
import os.path
|
||||
from contextlib import contextmanager
|
||||
|
||||
import django.test
|
||||
import mock
|
||||
import six
|
||||
from django.conf import settings
|
||||
from django.contrib.auth.models import User
|
||||
from django.contrib.sites.models import Site
|
||||
@@ -17,7 +20,6 @@ from provider import constants
|
||||
from provider.oauth2.models import Client as OAuth2Client
|
||||
from storages.backends.overwrite import OverwriteStorage
|
||||
|
||||
from third_party_auth.models import cache as config_cache
|
||||
from third_party_auth.models import (
|
||||
LTIProviderConfig,
|
||||
OAuth2ProviderConfig,
|
||||
@@ -25,6 +27,7 @@ from third_party_auth.models import (
|
||||
SAMLConfiguration,
|
||||
SAMLProviderConfig
|
||||
)
|
||||
from third_party_auth.models import cache as config_cache
|
||||
|
||||
AUTH_FEATURES_KEY = 'ENABLE_THIRD_PARTY_AUTH'
|
||||
AUTH_FEATURE_ENABLED = AUTH_FEATURES_KEY in settings.FEATURES
|
||||
@@ -47,7 +50,7 @@ class FakeDjangoSettings(object):
|
||||
|
||||
def __init__(self, mappings):
|
||||
"""Initializes the fake from mappings dict."""
|
||||
for key, value in mappings.iteritems():
|
||||
for key, value in six.iteritems(mappings):
|
||||
setattr(self, key, value)
|
||||
|
||||
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
"""Common utility for testing third party oauth2 features."""
|
||||
from __future__ import absolute_import
|
||||
|
||||
import json
|
||||
from base64 import b64encode
|
||||
|
||||
import httpretty
|
||||
from onelogin.saml2.utils import OneLogin_Saml2_Utils
|
||||
|
||||
from provider.constants import PUBLIC
|
||||
from provider.oauth2.models import Client
|
||||
from social_core.backends.facebook import FacebookOAuth2, API_VERSION as FACEBOOK_API_VERSION
|
||||
from social_django.models import UserSocialAuth, Partial
|
||||
from social_core.backends.facebook import API_VERSION as FACEBOOK_API_VERSION
|
||||
from social_core.backends.facebook import FacebookOAuth2
|
||||
from social_django.models import Partial, UserSocialAuth
|
||||
|
||||
from student.tests.factories import UserFactory
|
||||
|
||||
|
||||
Reference in New Issue
Block a user