Fix flake8 warnings
This commit fixes all warnings created by flake8 by removing unused imports and variable assignments. Some wrongly indented lines are now indented correctly.
This commit is contained in:
parent
30600ce107
commit
fb1f31a9bc
12 changed files with 50 additions and 49 deletions
|
@ -7,7 +7,6 @@ from __future__ import absolute_import, unicode_literals
|
||||||
import mock
|
import mock
|
||||||
from mock import MagicMock, Mock
|
from mock import MagicMock, Mock
|
||||||
|
|
||||||
from django.core import mail
|
|
||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
from django.contrib.sites.models import Site
|
from django.contrib.sites.models import Site
|
||||||
|
@ -25,7 +24,7 @@ class ContactFormTest(TestCase):
|
||||||
|
|
||||||
def test_constructor_needs_request(self):
|
def test_constructor_needs_request(self):
|
||||||
with self.assertRaises(KeyError):
|
with self.assertRaises(KeyError):
|
||||||
form = ContactForm()
|
ContactForm()
|
||||||
|
|
||||||
def test_constructor(self):
|
def test_constructor(self):
|
||||||
request = MagicMock()
|
request = MagicMock()
|
||||||
|
|
|
@ -64,11 +64,11 @@ class ContactFormViewTest(TestCase):
|
||||||
self.assertEqual(len(form.errors), 3)
|
self.assertEqual(len(form.errors), 3)
|
||||||
|
|
||||||
def test_post_empty_form_no_mail(self):
|
def test_post_empty_form_no_mail(self):
|
||||||
response = self.client.post(reverse('contact_form'), {})
|
self.client.post(reverse('contact_form'), {})
|
||||||
self.assertEqual(len(mail.outbox), 0)
|
self.assertEqual(len(mail.outbox), 0)
|
||||||
|
|
||||||
def test_get_contact_form_logged_in_no_fullname_initial(self):
|
def test_get_contact_form_logged_in_no_fullname_initial(self):
|
||||||
user = self._setup_user()
|
self._setup_user()
|
||||||
self.client.login(username=TEST_USER, password=TEST_PASSWORD)
|
self.client.login(username=TEST_USER, password=TEST_PASSWORD)
|
||||||
response = self.client.get(reverse('contact_form'))
|
response = self.client.get(reverse('contact_form'))
|
||||||
self.assertIn('form', response.context)
|
self.assertIn('form', response.context)
|
||||||
|
@ -77,7 +77,7 @@ class ContactFormViewTest(TestCase):
|
||||||
form.initial, {'name': TEST_USER, 'email': TEST_EMAIL})
|
form.initial, {'name': TEST_USER, 'email': TEST_EMAIL})
|
||||||
|
|
||||||
def test_get_contact_form_logged_in_fullname_initial(self):
|
def test_get_contact_form_logged_in_fullname_initial(self):
|
||||||
user = self._setup_user(
|
self._setup_user(
|
||||||
first_name=TEST_NAME[0], last_name=TEST_NAME[1])
|
first_name=TEST_NAME[0], last_name=TEST_NAME[1])
|
||||||
self.client.login(username=TEST_USER, password=TEST_PASSWORD)
|
self.client.login(username=TEST_USER, password=TEST_PASSWORD)
|
||||||
response = self.client.get(reverse('contact_form'))
|
response = self.client.get(reverse('contact_form'))
|
||||||
|
@ -93,12 +93,12 @@ class ContactFormViewTest(TestCase):
|
||||||
self.assertRedirects(response, reverse('contact_success'))
|
self.assertRedirects(response, reverse('contact_success'))
|
||||||
|
|
||||||
def test_post_filled_form_anonymous_mail(self):
|
def test_post_filled_form_anonymous_mail(self):
|
||||||
response = self.client.post(reverse('contact_form'), {
|
self.client.post(reverse('contact_form'), {
|
||||||
'name': TEST_USER, 'email': TEST_EMAIL, 'body': TEST_MESSAGE})
|
'name': TEST_USER, 'email': TEST_EMAIL, 'body': TEST_MESSAGE})
|
||||||
self.assertEqual(len(mail.outbox), 1)
|
self.assertEqual(len(mail.outbox), 1)
|
||||||
|
|
||||||
def test_post_filled_form_logged_in_redirects(self):
|
def test_post_filled_form_logged_in_redirects(self):
|
||||||
user = self._setup_user(
|
self._setup_user(
|
||||||
first_name=TEST_NAME[0], last_name=TEST_NAME[1])
|
first_name=TEST_NAME[0], last_name=TEST_NAME[1])
|
||||||
self.client.login(username=TEST_USER, password=TEST_PASSWORD)
|
self.client.login(username=TEST_USER, password=TEST_PASSWORD)
|
||||||
response = self.client.post(reverse('contact_form'), {
|
response = self.client.post(reverse('contact_form'), {
|
||||||
|
@ -106,11 +106,11 @@ class ContactFormViewTest(TestCase):
|
||||||
'body': TEST_MESSAGE})
|
'body': TEST_MESSAGE})
|
||||||
self.assertRedirects(response, reverse('contact_success'))
|
self.assertRedirects(response, reverse('contact_success'))
|
||||||
|
|
||||||
def test_post_filled_form_logged_in_redirects(self):
|
def test_post_filled_form_logged_in_mail(self):
|
||||||
user = self._setup_user(
|
self._setup_user(
|
||||||
first_name=TEST_NAME[0], last_name=TEST_NAME[1])
|
first_name=TEST_NAME[0], last_name=TEST_NAME[1])
|
||||||
self.client.login(username=TEST_USER, password=TEST_PASSWORD)
|
self.client.login(username=TEST_USER, password=TEST_PASSWORD)
|
||||||
response = self.client.post(reverse('contact_form'), {
|
self.client.post(reverse('contact_form'), {
|
||||||
'name': " ".join(TEST_NAME), 'email': TEST_EMAIL,
|
'name': " ".join(TEST_NAME), 'email': TEST_EMAIL,
|
||||||
'body': TEST_MESSAGE})
|
'body': TEST_MESSAGE})
|
||||||
self.assertEqual(len(mail.outbox), 1)
|
self.assertEqual(len(mail.outbox), 1)
|
||||||
|
|
|
@ -4,7 +4,7 @@ Tests for :py:mod:`domains.models`.
|
||||||
"""
|
"""
|
||||||
from __future__ import absolute_import, unicode_literals
|
from __future__ import absolute_import, unicode_literals
|
||||||
|
|
||||||
from mock import Mock, MagicMock, patch
|
from mock import patch
|
||||||
|
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
from django.contrib.auth import get_user_model
|
from django.contrib.auth import get_user_model
|
||||||
|
|
|
@ -58,7 +58,7 @@ class CreateHostingDomainTest(TestCase):
|
||||||
def test_get_staff_user(self):
|
def test_get_staff_user(self):
|
||||||
customer = User.objects.create_user('customer')
|
customer = User.objects.create_user('customer')
|
||||||
package = self._setup_hosting_package(customer)
|
package = self._setup_hosting_package(customer)
|
||||||
admin = User.objects.create_superuser(
|
User.objects.create_superuser(
|
||||||
TEST_USER, email=TEST_EMAIL, password=TEST_PASSWORD)
|
TEST_USER, email=TEST_EMAIL, password=TEST_PASSWORD)
|
||||||
self.client.login(username=TEST_USER, password=TEST_PASSWORD)
|
self.client.login(username=TEST_USER, password=TEST_PASSWORD)
|
||||||
response = self.client.get(
|
response = self.client.get(
|
||||||
|
@ -69,7 +69,7 @@ class CreateHostingDomainTest(TestCase):
|
||||||
def test_get_template(self):
|
def test_get_template(self):
|
||||||
customer = User.objects.create_user('customer')
|
customer = User.objects.create_user('customer')
|
||||||
package = self._setup_hosting_package(customer)
|
package = self._setup_hosting_package(customer)
|
||||||
admin = User.objects.create_superuser(
|
User.objects.create_superuser(
|
||||||
TEST_USER, email=TEST_EMAIL, password=TEST_PASSWORD)
|
TEST_USER, email=TEST_EMAIL, password=TEST_PASSWORD)
|
||||||
self.client.login(username=TEST_USER, password=TEST_PASSWORD)
|
self.client.login(username=TEST_USER, password=TEST_PASSWORD)
|
||||||
response = self.client.get(
|
response = self.client.get(
|
||||||
|
@ -78,7 +78,7 @@ class CreateHostingDomainTest(TestCase):
|
||||||
self.assertTemplateUsed(response, 'domains/hostingdomain_create.html')
|
self.assertTemplateUsed(response, 'domains/hostingdomain_create.html')
|
||||||
|
|
||||||
def test_get_no_package_found(self):
|
def test_get_no_package_found(self):
|
||||||
admin = User.objects.create_superuser(
|
User.objects.create_superuser(
|
||||||
TEST_USER, email=TEST_EMAIL, password=TEST_PASSWORD)
|
TEST_USER, email=TEST_EMAIL, password=TEST_PASSWORD)
|
||||||
self.client.login(username=TEST_USER, password=TEST_PASSWORD)
|
self.client.login(username=TEST_USER, password=TEST_PASSWORD)
|
||||||
response = self.client.get(
|
response = self.client.get(
|
||||||
|
@ -89,7 +89,7 @@ class CreateHostingDomainTest(TestCase):
|
||||||
def test_get_get_form_kwargs(self):
|
def test_get_get_form_kwargs(self):
|
||||||
customer = User.objects.create_user('customer')
|
customer = User.objects.create_user('customer')
|
||||||
package = self._setup_hosting_package(customer)
|
package = self._setup_hosting_package(customer)
|
||||||
admin = User.objects.create_superuser(
|
User.objects.create_superuser(
|
||||||
TEST_USER, email=TEST_EMAIL, password=TEST_PASSWORD)
|
TEST_USER, email=TEST_EMAIL, password=TEST_PASSWORD)
|
||||||
self.client.login(username=TEST_USER, password=TEST_PASSWORD)
|
self.client.login(username=TEST_USER, password=TEST_PASSWORD)
|
||||||
view = CreateHostingDomain(
|
view = CreateHostingDomain(
|
||||||
|
@ -101,7 +101,7 @@ class CreateHostingDomainTest(TestCase):
|
||||||
def test_get_context_data_has_hosting_package(self):
|
def test_get_context_data_has_hosting_package(self):
|
||||||
customer = User.objects.create_user('customer')
|
customer = User.objects.create_user('customer')
|
||||||
package = self._setup_hosting_package(customer)
|
package = self._setup_hosting_package(customer)
|
||||||
admin = User.objects.create_superuser(
|
User.objects.create_superuser(
|
||||||
TEST_USER, email=TEST_EMAIL, password=TEST_PASSWORD)
|
TEST_USER, email=TEST_EMAIL, password=TEST_PASSWORD)
|
||||||
self.client.login(username=TEST_USER, password=TEST_PASSWORD)
|
self.client.login(username=TEST_USER, password=TEST_PASSWORD)
|
||||||
response = self.client.get(
|
response = self.client.get(
|
||||||
|
@ -113,7 +113,7 @@ class CreateHostingDomainTest(TestCase):
|
||||||
def test_get_context_data_has_customer(self):
|
def test_get_context_data_has_customer(self):
|
||||||
customer = User.objects.create_user('customer')
|
customer = User.objects.create_user('customer')
|
||||||
package = self._setup_hosting_package(customer)
|
package = self._setup_hosting_package(customer)
|
||||||
admin = User.objects.create_superuser(
|
User.objects.create_superuser(
|
||||||
TEST_USER, email=TEST_EMAIL, password=TEST_PASSWORD)
|
TEST_USER, email=TEST_EMAIL, password=TEST_PASSWORD)
|
||||||
self.client.login(username=TEST_USER, password=TEST_PASSWORD)
|
self.client.login(username=TEST_USER, password=TEST_PASSWORD)
|
||||||
response = self.client.get(
|
response = self.client.get(
|
||||||
|
@ -125,7 +125,7 @@ class CreateHostingDomainTest(TestCase):
|
||||||
def test_form_valid_redirect(self):
|
def test_form_valid_redirect(self):
|
||||||
customer = User.objects.create_user('customer')
|
customer = User.objects.create_user('customer')
|
||||||
package = self._setup_hosting_package(customer)
|
package = self._setup_hosting_package(customer)
|
||||||
admin = User.objects.create_superuser(
|
User.objects.create_superuser(
|
||||||
TEST_USER, email=TEST_EMAIL, password=TEST_PASSWORD)
|
TEST_USER, email=TEST_EMAIL, password=TEST_PASSWORD)
|
||||||
self.client.login(username=TEST_USER, password=TEST_PASSWORD)
|
self.client.login(username=TEST_USER, password=TEST_PASSWORD)
|
||||||
response = self.client.post(
|
response = self.client.post(
|
||||||
|
@ -137,7 +137,7 @@ class CreateHostingDomainTest(TestCase):
|
||||||
def test_form_valid_message(self):
|
def test_form_valid_message(self):
|
||||||
customer = User.objects.create_user('customer')
|
customer = User.objects.create_user('customer')
|
||||||
package = self._setup_hosting_package(customer)
|
package = self._setup_hosting_package(customer)
|
||||||
admin = User.objects.create_superuser(
|
User.objects.create_superuser(
|
||||||
TEST_USER, email=TEST_EMAIL, password=TEST_PASSWORD)
|
TEST_USER, email=TEST_EMAIL, password=TEST_PASSWORD)
|
||||||
self.client.login(username=TEST_USER, password=TEST_PASSWORD)
|
self.client.login(username=TEST_USER, password=TEST_PASSWORD)
|
||||||
response = self.client.post(
|
response = self.client.post(
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
from gnuviechadmin.celery import app as celery_app
|
# import celery_app to initialize it
|
||||||
|
from gnuviechadmin.celery import app as celery_app # NOQA
|
||||||
|
|
||||||
__version__ = '0.12.dev1'
|
__version__ = '0.12.dev1'
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
|
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
|
|
||||||
from .base import *
|
# use import * to import all settings from base
|
||||||
|
from .base import * # NOQA
|
||||||
|
|
||||||
|
|
||||||
# ######### DEBUG CONFIGURATION
|
# ######### DEBUG CONFIGURATION
|
||||||
|
|
|
@ -4,7 +4,8 @@
|
||||||
|
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
|
|
||||||
from .base import *
|
# use import * to import all settings from base
|
||||||
|
from .base import * # NOQA
|
||||||
|
|
||||||
# ######### HOST CONFIGURATION
|
# ######### HOST CONFIGURATION
|
||||||
# See: https://docs.djangoproject.com/en/1.5/releases/1.5/#allowed-hosts-required-in-production # noqa
|
# See: https://docs.djangoproject.com/en/1.5/releases/1.5/#allowed-hosts-required-in-production # noqa
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
|
|
||||||
from .base import *
|
# use import * to import all settings from base
|
||||||
|
from .base import * # NOQA
|
||||||
|
|
||||||
PASSWORD_HASHERS = (
|
PASSWORD_HASHERS = (
|
||||||
'django.contrib.auth.hashers.MD5PasswordHasher',
|
'django.contrib.auth.hashers.MD5PasswordHasher',
|
||||||
|
|
|
@ -56,7 +56,7 @@ class NavigationContextProcessorTest(TestCase):
|
||||||
self.assertEqual(response.context['active_item'], 'contact')
|
self.assertEqual(response.context['active_item'], 'contact')
|
||||||
|
|
||||||
def test_hostingpackage_page_context(self):
|
def test_hostingpackage_page_context(self):
|
||||||
user = User.objects.create_user('test', password='test')
|
User.objects.create_user('test', password='test')
|
||||||
self.client.login(username='test', password='test')
|
self.client.login(username='test', password='test')
|
||||||
response = self.client.get(
|
response = self.client.get(
|
||||||
reverse('hosting_packages', kwargs={'user': 'test'}))
|
reverse('hosting_packages', kwargs={'user': 'test'}))
|
||||||
|
|
|
@ -18,4 +18,9 @@ class OsusersAppConfig(AppConfig):
|
||||||
verbose_name = _('Operating System Users and Groups')
|
verbose_name = _('Operating System Users and Groups')
|
||||||
|
|
||||||
def ready(self):
|
def ready(self):
|
||||||
import osusers.signals
|
"""
|
||||||
|
Takes care of importing the signal handlers of the :py:mod:`osusers`
|
||||||
|
app.
|
||||||
|
|
||||||
|
"""
|
||||||
|
import osusers.signals # NOQA
|
||||||
|
|
|
@ -10,8 +10,6 @@ import logging
|
||||||
import os
|
import os
|
||||||
import six
|
import six
|
||||||
|
|
||||||
from celery import group
|
|
||||||
|
|
||||||
from django.db import models, transaction
|
from django.db import models, transaction
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
|
@ -25,8 +23,6 @@ from model_utils.models import TimeStampedModel
|
||||||
from passlib.hash import sha512_crypt
|
from passlib.hash import sha512_crypt
|
||||||
from passlib.utils import generate_password
|
from passlib.utils import generate_password
|
||||||
|
|
||||||
from taskresults.models import TaskResult
|
|
||||||
|
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
|
@ -7,14 +7,11 @@ from __future__ import absolute_import, unicode_literals
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from django.db.models.signals import (
|
from django.db.models.signals import (
|
||||||
m2m_changed,
|
|
||||||
post_delete,
|
post_delete,
|
||||||
post_save,
|
post_save,
|
||||||
)
|
)
|
||||||
from django.dispatch import receiver
|
from django.dispatch import receiver
|
||||||
|
|
||||||
from celery import chain, group
|
|
||||||
|
|
||||||
from fileservertasks.tasks import (
|
from fileservertasks.tasks import (
|
||||||
delete_file_mail_userdir,
|
delete_file_mail_userdir,
|
||||||
delete_file_sftp_userdir,
|
delete_file_sftp_userdir,
|
||||||
|
|
Loading…
Reference in a new issue