Skip to content

Commit

Permalink
Fix isort errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ArmaanT committed Apr 2, 2019
1 parent b82a51d commit bfcd9ae
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 12 deletions.
1 change: 1 addition & 0 deletions accounts/admin.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from django.contrib import admin

from accounts.models import User


Expand Down
4 changes: 2 additions & 2 deletions accounts/models.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django.db import models
from django.contrib.auth.models import AbstractUser
from django.db import models


class User(AbstractUser):
uuid = models.UUIDField(editable=False, default="00000000000000000000000000000000")
uuid = models.UUIDField(editable=False, default='00000000000000000000000000000000')
6 changes: 4 additions & 2 deletions accounts/settings.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import os

from django.conf import settings

USER_SETTINGS = getattr(settings, "PLATFORM_ACCOUNTS", {})

USER_SETTINGS = getattr(settings, 'PLATFORM_ACCOUNTS', {})

DEFAULTS = {
'CLIENT_ID': os.environ.get('LABS_CLIENT_ID'),
Expand All @@ -22,7 +24,7 @@ def __init__(self, settings=None, defaults=None):

def __getattr__(self, attr):
if attr not in self.defaults.keys():
raise AttributeError("Invalid Penn Labs accounts setting: %s" % attr)
raise AttributeError('Invalid Penn Labs accounts setting: %s' % attr)

try:
val = self.settings[attr]
Expand Down
1 change: 1 addition & 0 deletions accounts/urls.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from django.urls import path

from accounts.views import CallbackView, LoginView


Expand Down
5 changes: 3 additions & 2 deletions accounts/views.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
from requests_oauthlib import OAuth2Session
from django.contrib import auth
from django.http import HttpResponseServerError
from django.http.response import HttpResponseBadRequest
from django.shortcuts import redirect
from django.views import View
from requests_oauthlib import OAuth2Session

from accounts.settings import accounts_settings


class LoginView(View):
def get(self, request):
return_to = request.GET.get('next')
if not return_to:
return HttpResponseBadRequest("Invalid next parameter")
return HttpResponseBadRequest('Invalid next parameter')
request.session.__setitem__('next', return_to)
if not request.user.is_authenticated:
platform = OAuth2Session(
Expand Down
2 changes: 2 additions & 0 deletions runtests.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import sys

import django
from xmlrunner.extra.djangotestrunner import XMLTestRunner


django.setup()
test_runner = XMLTestRunner(verbosity=2)

Expand Down
1 change: 1 addition & 0 deletions tests/test_apps.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from django.test import TestCase

from accounts.apps import AccountsConfig


Expand Down
2 changes: 1 addition & 1 deletion tests/test_backends.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django.test import TestCase
from django.contrib import auth
from django.contrib.auth import get_user_model
from django.test import TestCase


class BackendTestCase(TestCase):
Expand Down
3 changes: 2 additions & 1 deletion tests/test_settings.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from django.test import TestCase
from tests.settings import PLATFORM_ACCOUNTS
from accounts.settings import accounts_settings, DEFAULTS

from accounts.settings import DEFAULTS, accounts_settings


class SettingsTestCase(TestCase):
Expand Down
8 changes: 5 additions & 3 deletions tests/test_views.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
from unittest.mock import patch
import urllib.parse
from django.test import TestCase, Client
from django.urls import reverse
from unittest.mock import patch

from django.contrib.auth import get_user_model
from django.test import Client, TestCase
from django.urls import reverse

from accounts.settings import accounts_settings


Expand Down
4 changes: 3 additions & 1 deletion tests/urls.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
from django.urls import path, include
from django.urls import include, path


urlpatterns = [path('accounts/', include('accounts.urls', namespace='accounts'))]

0 comments on commit bfcd9ae

Please sign in to comment.