diff --git a/authentik/core/tests/test_users_avatars.py b/authentik/core/tests/test_users_avatars.py index 98381db0f..01f703c61 100644 --- a/authentik/core/tests/test_users_avatars.py +++ b/authentik/core/tests/test_users_avatars.py @@ -19,6 +19,7 @@ class TestUsersAvatars(APITestCase): self.user = User.objects.create(username="test-user") def set_avatar_mode(self, mode: str): + """Set the avatar mode on the current tenant.""" tenant = get_current_tenant() tenant.avatars = mode tenant.save() diff --git a/authentik/policies/reputation/models.py b/authentik/policies/reputation/models.py index e11b69520..e2b216b44 100644 --- a/authentik/policies/reputation/models.py +++ b/authentik/policies/reputation/models.py @@ -11,7 +11,6 @@ from rest_framework.serializers import BaseSerializer from structlog import get_logger from authentik.core.models import ExpiringModel -from authentik.lib.config import CONFIG from authentik.lib.models import SerializerModel from authentik.lib.utils.http import get_client_ip from authentik.policies.models import Policy diff --git a/authentik/tenants/apps.py b/authentik/tenants/apps.py index 2e21f5208..eecec031c 100644 --- a/authentik/tenants/apps.py +++ b/authentik/tenants/apps.py @@ -5,7 +5,7 @@ from django.db.models.signals import post_migrate from authentik.blueprints.apps import ManagedAppConfig -def reconcile_default_tenant(using=DEFAULT_DB_ALIAS, *args, **kwargs): +def reconcile_default_tenant(*args, using=DEFAULT_DB_ALIAS, **kwargs): """Make sure default tenant exists""" from authentik.tenants.models import Tenant @@ -24,5 +24,6 @@ class AuthentikTenantsConfig(ManagedAppConfig): default = True def reconcile_default_tenant(self): + """Make sure default tenant exists, especially after a migration""" reconcile_default_tenant() post_migrate.connect(reconcile_default_tenant)