diff --git a/authentik/core/tests/test_impersonation.py b/authentik/core/tests/test_impersonation.py index 6d07f4bbc..d37695c2a 100644 --- a/authentik/core/tests/test_impersonation.py +++ b/authentik/core/tests/test_impersonation.py @@ -7,6 +7,7 @@ from rest_framework.test import APITestCase from authentik.core.models import User from authentik.core.tests.utils import create_test_admin_user from authentik.lib.config import CONFIG +from authentik.tenants.utils import get_current_tenant class TestImpersonation(APITestCase): @@ -56,9 +57,11 @@ class TestImpersonation(APITestCase): response_body = loads(response.content.decode()) self.assertEqual(response_body["user"]["username"], self.other_user.username) - @CONFIG.patch("impersonation", False) def test_impersonate_disabled(self): """test impersonation that is disabled""" + tenant = get_current_tenant() + tenant.impersonation = False + tenant.save() self.client.force_login(self.user) response = self.client.post( diff --git a/authentik/tenants/migrations/0001_initial.py b/authentik/tenants/migrations/0001_initial.py index 0138494a5..b9cdf685d 100644 --- a/authentik/tenants/migrations/0001_initial.py +++ b/authentik/tenants/migrations/0001_initial.py @@ -26,9 +26,6 @@ def create_default_tenant(apps, schema_editor): footer_links=CONFIG.get("footer_links", default=[]), ) - Domain = apps.get_model("authentik_tenants", "Domain") - domain = Domain.objects.using(db_alias).create(domain="*", tenant=tenant, is_primary=True) - class Migration(migrations.Migration): initial = True