fix recovery tests

Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
This commit is contained in:
Marc 'risson' Schmitt 2024-01-12 03:15:14 +01:00
parent ca956aa70b
commit 7ce8af6192
No known key found for this signature in database
GPG Key ID: 9C3FA22FABF1AA8D
2 changed files with 3 additions and 5 deletions

View File

@ -2,6 +2,7 @@
from json import loads from json import loads
from django.urls import reverse from django.urls import reverse
from django_tenants.utils import get_public_schema_name
from authentik.core.models import Token, TokenIntents, User from authentik.core.models import Token, TokenIntents, User
from authentik.lib.config import CONFIG from authentik.lib.config import CONFIG
@ -18,10 +19,7 @@ class TestAPI(TenantAPITestCase):
def setUp(self): def setUp(self):
super().setUp() super().setUp()
self.tenant = Tenant.objects.create( self.tenant = Tenant.objects.get(schema_name=get_public_schema_name())
name=generate_id(),
schema_name="t_" + generate_id(length=63 - 2)
)
self.user: User = User.objects.create_user(username="recovery-test-user") self.user: User = User.objects.create_user(username="recovery-test-user")
@CONFIG.patch("outposts.disable_embedded_outpost", True) @CONFIG.patch("outposts.disable_embedded_outpost", True)

View File

@ -10,7 +10,7 @@ class TenantAPITestCase(APITransactionTestCase):
for db_name in self._databases_names(include_mirrors=False): for db_name in self._databases_names(include_mirrors=False):
with connections[db_name].cursor() as cursor: with connections[db_name].cursor() as cursor:
cursor.execute( cursor.execute(
"SELECT nspname FROM pg_catalog.pg_namespace WHERE nspname !~ 'pg_*' AND nspname != 'information_schema' AND nspname != 'public' AND nspname != 'template'" "SELECT nspname FROM pg_catalog.pg_namespace WHERE nspname ~ 't_.*'"
) )
schemas = cursor.fetchall() schemas = cursor.fetchall()
for row in schemas: for row in schemas: