From fa96a8bf6a2cb4d26c520577bbaa0d73c4315842 Mon Sep 17 00:00:00 2001 From: Ben Lopatin Date: Thu, 23 Nov 2023 12:42:53 -0500 Subject: [PATCH] Formatting --- conftest.py | 2 ++ docs/conf.py | 3 +-- example/accounts/admin.py | 5 +++-- example/accounts/migrations/0001_initial.py | 15 +++++++++++---- example/accounts/models.py | 10 ++++------ example/conf/urls.py | 6 +++--- example/conf/wsgi.py | 10 +--------- example/vendors/admin.py | 5 +++-- example/vendors/migrations/0001_initial.py | 15 +++++++++++---- example/vendors/models.py | 10 ++++------ noxfile.py | 4 +--- setup.py | 1 + src/organizations/abstract.py | 4 +--- src/organizations/admin.py | 1 - src/organizations/app_settings.py | 1 - src/organizations/apps.py | 1 - src/organizations/backends/__init__.py | 1 - src/organizations/backends/defaults.py | 5 ++--- src/organizations/backends/forms.py | 1 - src/organizations/backends/modeled.py | 14 +++++++------- src/organizations/base.py | 5 ++--- src/organizations/base_admin.py | 1 - src/organizations/exceptions.py | 2 -- src/organizations/forms.py | 1 - src/organizations/managers.py | 1 - src/organizations/migrations/0001_initial.py | 4 +++- .../migrations/0004_organizationinvitation.py | 5 ++++- .../0005_alter_organization_users_and_more.py | 5 +++-- .../migrations/0006_alter_organization_slug.py | 1 + src/organizations/models.py | 1 - src/organizations/signals.py | 1 - src/organizations/templatetags/org_tags.py | 1 - src/organizations/urls.py | 1 - src/organizations/utils.py | 1 - src/organizations/views/base.py | 1 - src/organizations/views/default.py | 1 - src/organizations/views/mixins.py | 1 - test_abstract/migrations/0001_initial.py | 4 +++- test_abstract/migrations/0002_custominvitation.py | 5 ++++- test_accounts/migrations/0001_initial.py | 1 - .../migrations/0003_accountinvitation.py | 6 ++++-- test_custom/migrations/0001_initial.py | 1 - test_custom/migrations/0002_model_update.py | 3 +-- test_vendors/migrations/0001_initial.py | 1 - test_vendors/migrations/0003_vendorinvitation.py | 6 ++++-- tests/backends/test_default_backend.py | 2 -- tests/test_forms.py | 10 ++++++---- tests/test_migrations.py | 3 +-- tests/test_mixins.py | 2 -- tests/test_models.py | 4 ---- tests/test_signals.py | 5 ----- tests/test_templatetags.py | 1 - tests/test_utils.py | 1 - tests/test_views.py | 7 ++++--- 54 files changed, 95 insertions(+), 114 deletions(-) diff --git a/conftest.py b/conftest.py index c3e97676..21be2a62 100644 --- a/conftest.py +++ b/conftest.py @@ -3,6 +3,7 @@ """ import django + import pytest @@ -67,6 +68,7 @@ def pytest_configure(): ) django.setup() + @pytest.fixture(autouse=True) def enable_db_access_for_all_tests(db): pass diff --git a/docs/conf.py b/docs/conf.py index 4a0099e5..453a75e6 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -10,7 +10,6 @@ # All configuration values have a default; values that are commented out # serve to show the default. -import sys, os # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the @@ -90,7 +89,7 @@ # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. -html_theme = 'furo' +html_theme = "furo" # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the diff --git a/example/accounts/admin.py b/example/accounts/admin.py index e0d609d0..381d0600 100644 --- a/example/accounts/admin.py +++ b/example/accounts/admin.py @@ -1,7 +1,8 @@ from django.contrib import admin -from .models import Account, AccountUser, AccountOwner - +from .models import Account +from .models import AccountOwner +from .models import AccountUser admin.site.register(Account) admin.site.register(AccountUser) diff --git a/example/accounts/migrations/0001_initial.py b/example/accounts/migrations/0001_initial.py index 1be8ee72..60312190 100644 --- a/example/accounts/migrations/0001_initial.py +++ b/example/accounts/migrations/0001_initial.py @@ -1,9 +1,11 @@ # Generated by Django 2.2.4 on 2019-12-10 18:25 -from django.conf import settings -from django.db import migrations, models import django.db.models.deletion import django.utils.timezone +from django.conf import settings +from django.db import migrations +from django.db import models + import organizations.base import organizations.fields @@ -50,7 +52,9 @@ class Migration(migrations.Migration): organizations.fields.SlugField( blank=True, editable=False, - help_text="The name in all lowercase, suitable for URL identification", + help_text=( + "The name in all lowercase, suitable for URL identification" + ), max_length=200, populate_from="name", unique=True, @@ -178,7 +182,10 @@ class Migration(migrations.Migration): ( "invitee_identifier", models.CharField( - help_text="The contact identifier for the invitee, email, phone number, social media handle, etc.", + help_text=( + "The contact identifier for the invitee, email, " + "phone number, social media handle, etc." + ), max_length=1000, ), ), diff --git a/example/accounts/models.py b/example/accounts/models.py index 8821e7e6..b42cc558 100644 --- a/example/accounts/models.py +++ b/example/accounts/models.py @@ -1,11 +1,9 @@ from django.db import models -from organizations.abstract import ( - AbstractOrganization, - AbstractOrganizationInvitation, - AbstractOrganizationOwner, - AbstractOrganizationUser, -) +from organizations.abstract import AbstractOrganization +from organizations.abstract import AbstractOrganizationInvitation +from organizations.abstract import AbstractOrganizationOwner +from organizations.abstract import AbstractOrganizationUser class Account(AbstractOrganization): diff --git a/example/conf/urls.py b/example/conf/urls.py index e1c38bad..16de047a 100644 --- a/example/conf/urls.py +++ b/example/conf/urls.py @@ -1,9 +1,9 @@ -from django.conf.urls import include, url +from django.conf.urls import include from django.contrib import admin from django.urls import path -from organizations.backends import invitation_backend, registration_backend - +from organizations.backends import invitation_backend +from organizations.backends import registration_backend urlpatterns = [ path("admin/", admin.site.urls), diff --git a/example/conf/wsgi.py b/example/conf/wsgi.py index 9358bbd9..09ab39ef 100644 --- a/example/conf/wsgi.py +++ b/example/conf/wsgi.py @@ -15,15 +15,7 @@ """ import os -os.environ.setdefault("DJANGO_SETTINGS_MODULE", "conf.settings") - -# This application object is used by any WSGI server configured to use this -# file. This includes Django's development server, if the WSGI_APPLICATION -# setting points here. from django.core.wsgi import get_wsgi_application +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "conf.settings") application = get_wsgi_application() - -# Apply WSGI middleware here. -# from helloworld.wsgi import HelloWorldApplication -# application = HelloWorldApplication(application) diff --git a/example/vendors/admin.py b/example/vendors/admin.py index e4e9b045..e0362f47 100644 --- a/example/vendors/admin.py +++ b/example/vendors/admin.py @@ -1,7 +1,8 @@ from django.contrib import admin -from .models import Vendor, VendorUser, VendorOwner - +from .models import Vendor +from .models import VendorOwner +from .models import VendorUser admin.site.register(Vendor) admin.site.register(VendorUser) diff --git a/example/vendors/migrations/0001_initial.py b/example/vendors/migrations/0001_initial.py index 6a3d47ce..875bac04 100644 --- a/example/vendors/migrations/0001_initial.py +++ b/example/vendors/migrations/0001_initial.py @@ -1,9 +1,11 @@ # Generated by Django 2.2.4 on 2019-12-10 18:25 -from django.conf import settings -from django.db import migrations, models import django.db.models.deletion import django.utils.timezone +from django.conf import settings +from django.db import migrations +from django.db import models + import organizations.base import organizations.fields @@ -54,7 +56,9 @@ class Migration(migrations.Migration): organizations.fields.SlugField( blank=True, editable=False, - help_text="The name in all lowercase, suitable for URL identification", + help_text=( + "The name in all lowercase, suitable for URL identification" + ), max_length=200, populate_from="name", unique=True, @@ -195,7 +199,10 @@ class Migration(migrations.Migration): ( "invitee_identifier", models.CharField( - help_text="The contact identifier for the invitee, email, phone number, social media handle, etc.", + help_text=( + "The contact identifier for the invitee, email, " + "phone number, social media handle, etc." + ), max_length=1000, ), ), diff --git a/example/vendors/models.py b/example/vendors/models.py index bbfabee8..750d607c 100644 --- a/example/vendors/models.py +++ b/example/vendors/models.py @@ -1,12 +1,10 @@ from django.contrib.auth.models import Permission from django.db import models -from organizations.abstract import ( - AbstractOrganization, - AbstractOrganizationInvitation, - AbstractOrganizationOwner, - AbstractOrganizationUser, -) +from organizations.abstract import AbstractOrganization +from organizations.abstract import AbstractOrganizationInvitation +from organizations.abstract import AbstractOrganizationOwner +from organizations.abstract import AbstractOrganizationUser class Vendor(AbstractOrganization): diff --git a/noxfile.py b/noxfile.py index 30e74aae..9bdf5427 100644 --- a/noxfile.py +++ b/noxfile.py @@ -8,7 +8,6 @@ import nox - NOX_DIR = os.path.abspath(os.path.dirname(__file__)) DEFAULT_INTERPRETER = "3.8" @@ -46,7 +45,7 @@ def manage(session, *args): session.install("six") session.install("django-autoslug") session.install("Django==3.1") - session.install('-e', '.') + session.install("-e", ".") args = args if args else session.posargs session.run("python", "manage.py", *args) @@ -105,7 +104,6 @@ def publish(session): session.run("python", "-m", "twine", "upload", "dist/*") - @nox.session(python=DEFAULT_INTERPRETER, reuse_venv=True) def docs(session): session.run("make", "-C", "docs", "clean") diff --git a/setup.py b/setup.py index 850f5fc6..6d77cc41 100644 --- a/setup.py +++ b/setup.py @@ -3,4 +3,5 @@ """ from setuptools import setup + setup() diff --git a/src/organizations/abstract.py b/src/organizations/abstract.py index 1b6ce3cd..77d8fd1f 100644 --- a/src/organizations/abstract.py +++ b/src/organizations/abstract.py @@ -1,4 +1,3 @@ - import warnings from django.conf import settings @@ -6,13 +5,12 @@ from django.urls import reverse from django.utils.translation import gettext_lazy as _ - from organizations.base import AbstractBaseInvitation from organizations.base import AbstractBaseOrganization from organizations.base import AbstractBaseOrganizationOwner from organizations.base import AbstractBaseOrganizationUser -from organizations.base import with_metaclass from organizations.base import OrgMeta +from organizations.base import with_metaclass from organizations.fields import AutoCreatedField from organizations.fields import AutoLastModifiedField from organizations.fields import SlugField diff --git a/src/organizations/admin.py b/src/organizations/admin.py index 5f5876cd..cad9eeb4 100644 --- a/src/organizations/admin.py +++ b/src/organizations/admin.py @@ -1,4 +1,3 @@ - from django.contrib import admin from organizations import models diff --git a/src/organizations/app_settings.py b/src/organizations/app_settings.py index 12b37974..b3381ad1 100644 --- a/src/organizations/app_settings.py +++ b/src/organizations/app_settings.py @@ -1,4 +1,3 @@ - from django.conf import settings from django.contrib.auth.models import User diff --git a/src/organizations/apps.py b/src/organizations/apps.py index 8e233022..fffa81f1 100644 --- a/src/organizations/apps.py +++ b/src/organizations/apps.py @@ -1,4 +1,3 @@ - from django.apps import AppConfig diff --git a/src/organizations/backends/__init__.py b/src/organizations/backends/__init__.py index d8f9d14a..a3bb1479 100644 --- a/src/organizations/backends/__init__.py +++ b/src/organizations/backends/__init__.py @@ -1,4 +1,3 @@ - from importlib import import_module from typing import Optional # noqa from typing import Text # noqa diff --git a/src/organizations/backends/defaults.py b/src/organizations/backends/defaults.py index caac61e1..ab3c8d39 100644 --- a/src/organizations/backends/defaults.py +++ b/src/organizations/backends/defaults.py @@ -1,4 +1,3 @@ - """Backend classes should provide common interface""" import email.utils @@ -144,8 +143,8 @@ def email_message( ): """ Returns an email message for a new user. This can be easily overridden. - For instance, to send an HTML message, use the EmailMultiAlternatives message_class - and attach the additional conent. + For instance, to send an HTML message, use the EmailMultiAlternatives + message_class and attach the additional conent. """ if sender: try: diff --git a/src/organizations/backends/forms.py b/src/organizations/backends/forms.py index 4f07ca2c..1eb43014 100644 --- a/src/organizations/backends/forms.py +++ b/src/organizations/backends/forms.py @@ -1,4 +1,3 @@ - from django import forms from django.contrib.auth.forms import UserCreationForm diff --git a/src/organizations/backends/modeled.py b/src/organizations/backends/modeled.py index dc30bac8..df13ee4e 100644 --- a/src/organizations/backends/modeled.py +++ b/src/organizations/backends/modeled.py @@ -1,4 +1,3 @@ - """ Invitations that use an invitation model """ @@ -42,12 +41,13 @@ class ModelInvitation(InvitationBackend): def __init__(self, org_model=None, namespace=None): super().__init__(org_model=org_model, namespace=namespace) - self.invitation_model = ( - self.org_model.invitation_model - ) # type: OrganizationInvitationBase + self.invitation_model = self.org_model.invitation_model # type: OrganizationInvitationBase # noqa: E501 def get_invitation_queryset(self): - """Return this to use a custom queryset that checks for expiration, for example""" + """Return available invitations. + + Use a custom queryset that checks for expiration, for example. + """ return self.invitation_model.objects.all() def get_invitation_accepted_url(self): @@ -171,8 +171,8 @@ def email_message( ): """ Returns an invitation email message. This can be easily overridden. - For instance, to send an HTML message, use the EmailMultiAlternatives message_class - and attach the additional conent. + For instance, to send an HTML message, use the EmailMultiAlternatives + message_class and attach the additional conent. """ from_email = "%s %s <%s>" % ( sender.first_name, diff --git a/src/organizations/base.py b/src/organizations/base.py index 7c008f16..4ef71ad4 100644 --- a/src/organizations/base.py +++ b/src/organizations/base.py @@ -1,4 +1,3 @@ - import uuid from django.conf import settings @@ -24,7 +23,6 @@ def __new__(cls, name, this_bases, d): return type.__new__(metaclass, "temporary_class", (), {}) - class OrgMeta(ModelBase): """ Base metaclass for dynamically linking related organization models. @@ -326,7 +324,8 @@ class AbstractBaseInvitation(models.Model): invitee_identifier = models.CharField( max_length=1000, help_text=_( - "The contact identifier for the invitee, email, phone number, social media handle, etc." + "The contact identifier for the invitee, email, phone number," + " social media handle, etc." ), ) diff --git a/src/organizations/base_admin.py b/src/organizations/base_admin.py index c7b92a6a..df993a47 100644 --- a/src/organizations/base_admin.py +++ b/src/organizations/base_admin.py @@ -1,4 +1,3 @@ - from django.contrib import admin diff --git a/src/organizations/exceptions.py b/src/organizations/exceptions.py index 6b9e606d..323765c7 100644 --- a/src/organizations/exceptions.py +++ b/src/organizations/exceptions.py @@ -1,5 +1,3 @@ - - class OwnershipRequired(Exception): """ Exception to raise if the owner is being removed before the diff --git a/src/organizations/forms.py b/src/organizations/forms.py index a72e75cd..a4f6f7e4 100644 --- a/src/organizations/forms.py +++ b/src/organizations/forms.py @@ -1,4 +1,3 @@ - from django import forms from django.contrib.auth import get_user_model from django.contrib.sites.shortcuts import get_current_site diff --git a/src/organizations/managers.py b/src/organizations/managers.py index c491e90a..364ef81b 100644 --- a/src/organizations/managers.py +++ b/src/organizations/managers.py @@ -1,4 +1,3 @@ - from django.db import models diff --git a/src/organizations/migrations/0001_initial.py b/src/organizations/migrations/0001_initial.py index a5b7820c..3589efa3 100644 --- a/src/organizations/migrations/0001_initial.py +++ b/src/organizations/migrations/0001_initial.py @@ -51,7 +51,9 @@ class Migration(migrations.Migration): "slug", organizations.fields.SlugField( editable=True, - help_text="The name in all lowercase, suitable for URL identification", + help_text=( + "The name in all lowercase, suitable for URL identification" + ), max_length=200, populate_from="name", unique=True, diff --git a/src/organizations/migrations/0004_organizationinvitation.py b/src/organizations/migrations/0004_organizationinvitation.py index e58c8913..5edae699 100644 --- a/src/organizations/migrations/0004_organizationinvitation.py +++ b/src/organizations/migrations/0004_organizationinvitation.py @@ -33,7 +33,10 @@ class Migration(migrations.Migration): ( "invitee_identifier", models.CharField( - help_text="The contact identifier for the invitee, email, phone number, social media handle, etc.", + help_text=( + "The contact identifier for the invitee, email, " + "phone number, social media handle, etc." + ), max_length=1000, ), ), diff --git a/src/organizations/migrations/0005_alter_organization_users_and_more.py b/src/organizations/migrations/0005_alter_organization_users_and_more.py index eb0c551c..a0cc28c9 100644 --- a/src/organizations/migrations/0005_alter_organization_users_and_more.py +++ b/src/organizations/migrations/0005_alter_organization_users_and_more.py @@ -1,8 +1,9 @@ # Generated by Django 4.0.7 on 2022-09-30 17:00 -from django.conf import settings -from django.db import migrations, models import django.db.models.deletion +from django.conf import settings +from django.db import migrations +from django.db import models class Migration(migrations.Migration): diff --git a/src/organizations/migrations/0006_alter_organization_slug.py b/src/organizations/migrations/0006_alter_organization_slug.py index bf3373f2..a2e64ae3 100644 --- a/src/organizations/migrations/0006_alter_organization_slug.py +++ b/src/organizations/migrations/0006_alter_organization_slug.py @@ -1,6 +1,7 @@ # Generated by Django 4.0.7 on 2022-10-13 02:45 from django.db import migrations + import organizations.fields diff --git a/src/organizations/models.py b/src/organizations/models.py index 300da6dc..a8d752bb 100644 --- a/src/organizations/models.py +++ b/src/organizations/models.py @@ -1,4 +1,3 @@ - from organizations.abstract import AbstractOrganization from organizations.abstract import AbstractOrganizationInvitation from organizations.abstract import AbstractOrganizationOwner diff --git a/src/organizations/signals.py b/src/organizations/signals.py index f8ecb9cd..0db199c2 100644 --- a/src/organizations/signals.py +++ b/src/organizations/signals.py @@ -1,4 +1,3 @@ - import django.dispatch user_added = django.dispatch.Signal() diff --git a/src/organizations/templatetags/org_tags.py b/src/organizations/templatetags/org_tags.py index 5173e82c..1c0e6355 100644 --- a/src/organizations/templatetags/org_tags.py +++ b/src/organizations/templatetags/org_tags.py @@ -1,4 +1,3 @@ - from django import template register = template.Library() diff --git a/src/organizations/urls.py b/src/organizations/urls.py index 5f1aa6d5..7eeb8c40 100644 --- a/src/organizations/urls.py +++ b/src/organizations/urls.py @@ -1,4 +1,3 @@ - from django.contrib.auth.decorators import login_required from django.urls import include from django.urls import path diff --git a/src/organizations/utils.py b/src/organizations/utils.py index c863d5c3..be5057ea 100644 --- a/src/organizations/utils.py +++ b/src/organizations/utils.py @@ -1,4 +1,3 @@ - from itertools import chain diff --git a/src/organizations/views/base.py b/src/organizations/views/base.py index 2a3afa6b..1f4a12ff 100644 --- a/src/organizations/views/base.py +++ b/src/organizations/views/base.py @@ -1,4 +1,3 @@ - from django.contrib.sites.shortcuts import get_current_site from django.core.exceptions import ImproperlyConfigured from django.http import HttpResponseGone diff --git a/src/organizations/views/default.py b/src/organizations/views/default.py index f92300c8..8d2a3623 100644 --- a/src/organizations/views/default.py +++ b/src/organizations/views/default.py @@ -1,4 +1,3 @@ - from organizations.models import Organization from organizations.views.base import ViewFactory from organizations.views.mixins import AdminRequiredMixin diff --git a/src/organizations/views/mixins.py b/src/organizations/views/mixins.py index ec49fb71..551816e9 100644 --- a/src/organizations/views/mixins.py +++ b/src/organizations/views/mixins.py @@ -1,4 +1,3 @@ - from django.core.exceptions import PermissionDenied from django.shortcuts import get_object_or_404 from django.utils.functional import cached_property diff --git a/test_abstract/migrations/0001_initial.py b/test_abstract/migrations/0001_initial.py index 9d5d65b9..58bd9935 100644 --- a/test_abstract/migrations/0001_initial.py +++ b/test_abstract/migrations/0001_initial.py @@ -49,7 +49,9 @@ class Migration(migrations.Migration): "slug", organizations.fields.SlugField( editable=True, - help_text="The name in all lowercase, suitable for URL identification", + help_text=( + "The name in all lowercase, suitable for URL identification" + ), max_length=200, populate_from="name", unique=True, diff --git a/test_abstract/migrations/0002_custominvitation.py b/test_abstract/migrations/0002_custominvitation.py index 3248a65a..32d32d92 100644 --- a/test_abstract/migrations/0002_custominvitation.py +++ b/test_abstract/migrations/0002_custominvitation.py @@ -31,7 +31,10 @@ class Migration(migrations.Migration): ( "invitee_identifier", models.CharField( - help_text="The contact identifier for the invitee, email, phone number, social media handle, etc.", + help_text=( + "The contact identifier for the invitee, email, " + "phone number, social media handle, etc." + ), max_length=1000, ), ), diff --git a/test_accounts/migrations/0001_initial.py b/test_accounts/migrations/0001_initial.py index 4790782f..bd7d65df 100644 --- a/test_accounts/migrations/0001_initial.py +++ b/test_accounts/migrations/0001_initial.py @@ -3,7 +3,6 @@ from django.conf import settings from django.db import migrations, models import django.db.models.deletion -import organizations.base class Migration(migrations.Migration): diff --git a/test_accounts/migrations/0003_accountinvitation.py b/test_accounts/migrations/0003_accountinvitation.py index 8388e396..baeb031e 100644 --- a/test_accounts/migrations/0003_accountinvitation.py +++ b/test_accounts/migrations/0003_accountinvitation.py @@ -3,7 +3,6 @@ from django.conf import settings from django.db import migrations, models import django.db.models.deletion -import organizations.base class Migration(migrations.Migration): @@ -29,7 +28,10 @@ class Migration(migrations.Migration): ( "invitee_identifier", models.CharField( - help_text="The contact identifier for the invitee, email, phone number, social media handle, etc.", + help_text=( + "The contact identifier for the invitee, email, " + "phone number, social media handle, etc." + ), max_length=1000, ), ), diff --git a/test_custom/migrations/0001_initial.py b/test_custom/migrations/0001_initial.py index 27449595..0486e1ec 100644 --- a/test_custom/migrations/0001_initial.py +++ b/test_custom/migrations/0001_initial.py @@ -5,7 +5,6 @@ class Migration(migrations.Migration): - initial = True dependencies = [("organizations", "0001_initial")] diff --git a/test_custom/migrations/0002_model_update.py b/test_custom/migrations/0002_model_update.py index 85697998..a1c03bab 100644 --- a/test_custom/migrations/0002_model_update.py +++ b/test_custom/migrations/0002_model_update.py @@ -1,10 +1,9 @@ from __future__ import unicode_literals -from django.db import migrations, models +from django.db import migrations class Migration(migrations.Migration): - dependencies = [("test_custom", "0001_initial")] operations = [ diff --git a/test_vendors/migrations/0001_initial.py b/test_vendors/migrations/0001_initial.py index 1cb73211..bd0e9682 100644 --- a/test_vendors/migrations/0001_initial.py +++ b/test_vendors/migrations/0001_initial.py @@ -3,7 +3,6 @@ from django.conf import settings from django.db import migrations, models import django.db.models.deletion -import organizations.base class Migration(migrations.Migration): diff --git a/test_vendors/migrations/0003_vendorinvitation.py b/test_vendors/migrations/0003_vendorinvitation.py index 39075399..192b8a6e 100644 --- a/test_vendors/migrations/0003_vendorinvitation.py +++ b/test_vendors/migrations/0003_vendorinvitation.py @@ -3,7 +3,6 @@ from django.conf import settings from django.db import migrations, models import django.db.models.deletion -import organizations.base class Migration(migrations.Migration): @@ -29,7 +28,10 @@ class Migration(migrations.Migration): ( "invitee_identifier", models.CharField( - help_text="The contact identifier for the invitee, email, phone number, social media handle, etc.", + help_text=( + "The contact identifier for the invitee, email, " + "phone number, social media handle, etc." + ), max_length=1000, ), ), diff --git a/tests/backends/test_default_backend.py b/tests/backends/test_default_backend.py index 29a2ae56..edcd3560 100644 --- a/tests/backends/test_default_backend.py +++ b/tests/backends/test_default_backend.py @@ -50,7 +50,6 @@ def test_backend_urls(self): @override_settings(USE_TZ=True) class TestInvitations(TestCase): - fixtures = ["users.json", "orgs.json"] def setUp(self): @@ -144,7 +143,6 @@ def test_send_notification_active_user(self): @override_settings(USE_TZ=True) class TestRegistration(TestCase): - fixtures = ["users.json", "orgs.json"] def setUp(self): diff --git a/tests/test_forms.py b/tests/test_forms.py index 4d298716..d264b43a 100644 --- a/tests/test_forms.py +++ b/tests/test_forms.py @@ -62,7 +62,6 @@ def test_add_organization_for_new_user(self): class TestOrganizationUserAddForm(TestCase): - fixtures = ["users.json", "orgs.json"] def setUp(self): @@ -75,7 +74,9 @@ def test_multiple_users_exist(self): User.objects.create_user("asdkjf1", password="ajsdkfa3", email="bob@bob.com") request = request_factory_login(self.factory, self.owner.user) form = OrganizationUserAddForm( - request=request, organization=self.org, data={"email": "bob@bob.com"}, + request=request, + organization=self.org, + data={"email": "bob@bob.com"}, ) self.assertFalse(form.is_valid()) @@ -83,7 +84,9 @@ def test_add_user_already_in_organization(self): admin = self.org.organization_users.get(user__username="krist") request = request_factory_login(self.factory, self.owner.user) form = OrganizationUserAddForm( - request=request, organization=self.org, data={"email": admin.user.email}, + request=request, + organization=self.org, + data={"email": admin.user.email}, ) self.assertFalse(form.is_valid()) @@ -100,7 +103,6 @@ def test_save_org_user_add_form(self): @override_settings(USE_TZ=True) class TestOrganizationForm(TestCase): - fixtures = ["users.json", "orgs.json"] def setUp(self): diff --git a/tests/test_migrations.py b/tests/test_migrations.py index ee26c2df..6d2e9ca5 100644 --- a/tests/test_migrations.py +++ b/tests/test_migrations.py @@ -9,6 +9,5 @@ @pytest.mark.django_db def test_no_missing_migrations(): - """Check no model changes have been made since the last `./manage.py makemigrations`. - """ + """Verify that no changes are detected in the migrations.""" call_command("makemigrations", check=True, dry_run=True) diff --git a/tests/test_mixins.py b/tests/test_mixins.py index 756ace3b..076c449e 100644 --- a/tests/test_mixins.py +++ b/tests/test_mixins.py @@ -40,7 +40,6 @@ class UserView(OrganizationUserMixin, ViewStub): @override_settings(USE_TZ=True) class ObjectMixinTests(TestCase): - fixtures = ["users.json", "orgs.json"] def setUp(self): @@ -67,7 +66,6 @@ def test_get_model(self): @override_settings(USE_TZ=True) class AccessMixinTests(TestCase): - fixtures = ["users.json", "orgs.json"] def setUp(self): diff --git a/tests/test_models.py b/tests/test_models.py index 6aa73857..e26fcc89 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -18,7 +18,6 @@ @override_settings(USE_TZ=True) class ActiveManagerTests(TestCase): - fixtures = ["users.json", "orgs.json"] def test_active(self): @@ -33,7 +32,6 @@ def test_by_user(self): @override_settings(USE_TZ=True) class OrgModelTests(TestCase): - fixtures = ["users.json", "orgs.json"] def setUp(self): @@ -131,7 +129,6 @@ def test_nonmember_owner(self): @override_settings(USE_TZ=True) class OrgDeleteTests(TestCase): - fixtures = ["users.json", "orgs.json"] def test_delete_account(self): @@ -154,7 +151,6 @@ def test_delete_orguser(self): class CustomModelTests(TestCase): - # Load the world as we know it. fixtures = ["users.json", "orgs.json"] diff --git a/tests/test_signals.py b/tests/test_signals.py index 8b3f33ed..67e5ac1a 100644 --- a/tests/test_signals.py +++ b/tests/test_signals.py @@ -13,7 +13,6 @@ @override_settings(USE_TZ=True) class SignalsTestCase(TestCase): - fixtures = ["users.json", "orgs.json"] def setUp(self): @@ -27,7 +26,6 @@ def setUp(self): self.owner = self.org.organization_users.get(user__username="kurt") def test_user_added_called(self): - with mock_signal_receiver(user_added) as add_receiver: self.foo.add_user(self.krist) @@ -45,14 +43,12 @@ def test_user_added_called(self): ) def test_user_added_not_called(self): - with mock_signal_receiver(user_added) as add_receiver: self.foo.get_or_add_user(self.dave) self.assertEqual(add_receiver.call_args_list, []) def test_user_removed_called(self): - with mock_signal_receiver(user_removed) as remove_receiver: self.foo.add_user(self.krist) self.foo.remove_user(self.krist) @@ -63,7 +59,6 @@ def test_user_removed_called(self): ) def test_owner_changed_called(self): - with mock_signal_receiver(owner_changed) as changed_receiver: self.org.change_owner(self.admin) diff --git a/tests/test_templatetags.py b/tests/test_templatetags.py index 8cd01dc4..809951e4 100644 --- a/tests/test_templatetags.py +++ b/tests/test_templatetags.py @@ -9,7 +9,6 @@ @override_settings(USE_TZ=True) class TestTagsAndFilters(TestCase): - fixtures = ["users.json", "orgs.json"] def setUp(self): diff --git a/tests/test_utils.py b/tests/test_utils.py index d2bd39a1..138c8681 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -13,7 +13,6 @@ @override_settings(USE_TZ=True) class CreateOrgTests(TestCase): - fixtures = ["users.json", "orgs.json"] def setUp(self): diff --git a/tests/test_views.py b/tests/test_views.py index 77464084..86010ce2 100644 --- a/tests/test_views.py +++ b/tests/test_views.py @@ -127,7 +127,9 @@ class SignupView(base.OrganizationSignup): assert response.status_code == 302 # Verify its in the database - Organization.objects.get(slug="an-association-of-very-interesting-people", is_active=False) + Organization.objects.get( + slug="an-association-of-very-interesting-people", is_active=False + ) class TestBaseCreateOrganization: @@ -187,7 +189,6 @@ def test_delete_organization_user_with_post( @override_settings(USE_TZ=True) class TestBasicOrgViews(TestCase): - fixtures = ["users.json", "orgs.json"] def setUp(self): @@ -272,7 +273,7 @@ def test_bad_user_detail(self): request=self.kurt_request, kwargs=kwargs ).get, self.kurt_request, - **kwargs + **kwargs, ) def test_user_create_get(self):