fix some more tests
Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
This commit is contained in:
parent
5ede611f22
commit
59f1ef4ba0
|
@ -7,6 +7,7 @@ from rest_framework.test import APITestCase
|
||||||
from authentik.core.models import User
|
from authentik.core.models import User
|
||||||
from authentik.core.tests.utils import create_test_admin_user
|
from authentik.core.tests.utils import create_test_admin_user
|
||||||
from authentik.lib.config import CONFIG
|
from authentik.lib.config import CONFIG
|
||||||
|
from authentik.tenants.utils import get_current_tenant
|
||||||
|
|
||||||
|
|
||||||
class TestImpersonation(APITestCase):
|
class TestImpersonation(APITestCase):
|
||||||
|
@ -56,9 +57,11 @@ class TestImpersonation(APITestCase):
|
||||||
response_body = loads(response.content.decode())
|
response_body = loads(response.content.decode())
|
||||||
self.assertEqual(response_body["user"]["username"], self.other_user.username)
|
self.assertEqual(response_body["user"]["username"], self.other_user.username)
|
||||||
|
|
||||||
@CONFIG.patch("impersonation", False)
|
|
||||||
def test_impersonate_disabled(self):
|
def test_impersonate_disabled(self):
|
||||||
"""test impersonation that is disabled"""
|
"""test impersonation that is disabled"""
|
||||||
|
tenant = get_current_tenant()
|
||||||
|
tenant.impersonation = False
|
||||||
|
tenant.save()
|
||||||
self.client.force_login(self.user)
|
self.client.force_login(self.user)
|
||||||
|
|
||||||
response = self.client.post(
|
response = self.client.post(
|
||||||
|
|
|
@ -26,9 +26,6 @@ def create_default_tenant(apps, schema_editor):
|
||||||
footer_links=CONFIG.get("footer_links", default=[]),
|
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):
|
class Migration(migrations.Migration):
|
||||||
initial = True
|
initial = True
|
||||||
|
|
Reference in New Issue