From 59f1ef4ba01481c2bab70a51d48d66dc61d6e530 Mon Sep 17 00:00:00 2001 From: Marc 'risson' Schmitt Date: Tue, 21 Nov 2023 19:02:21 +0100 Subject: [PATCH] fix some more tests Signed-off-by: Marc 'risson' Schmitt --- authentik/core/tests/test_impersonation.py | 5 ++++- authentik/tenants/migrations/0001_initial.py | 3 --- 2 files changed, 4 insertions(+), 4 deletions(-) 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