fix some more tests
Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
"""event utilities"""
|
||||
|
||||
from collections.abc import KeysView
|
||||
import re
|
||||
from copy import copy
|
||||
from dataclasses import asdict, is_dataclass
|
||||
@ -108,6 +109,8 @@ def sanitize_item(value: Any) -> Any: # noqa: PLR0911, PLR0912
|
||||
value = asdict(value)
|
||||
if isinstance(value, dict):
|
||||
return sanitize_dict(value)
|
||||
if isinstance(value, KeysView):
|
||||
return list(value)
|
||||
if isinstance(value, GeneratorType):
|
||||
return sanitize_item(list(value))
|
||||
if isinstance(value, list | tuple | set):
|
||||
|
||||
@ -113,6 +113,8 @@ class UserLDAPSynchronizer(BaseLDAPSynchronizer):
|
||||
else:
|
||||
self._logger.debug("Synced User", user=ak_user.username, created=created)
|
||||
user_count += 1
|
||||
MicrosoftActiveDirectory(self._source).sync(attributes, ak_user, created)
|
||||
FreeIPA(self._source).sync(attributes, ak_user, created)
|
||||
MicrosoftActiveDirectory(self._source, self._task).sync(
|
||||
attributes, ak_user, created
|
||||
)
|
||||
FreeIPA(self._source, self._task).sync(attributes, ak_user, created)
|
||||
return user_count
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
from django.db.models.signals import post_save
|
||||
from django.conf import settings
|
||||
from django.dispatch import receiver
|
||||
|
||||
from authentik.tasks.schedules.models import ScheduledModel
|
||||
@ -8,6 +9,8 @@ from authentik.tasks.schedules.models import ScheduledModel
|
||||
def post_save_scheduled_model(sender, instance, **_):
|
||||
if not isinstance(instance, ScheduledModel):
|
||||
return
|
||||
if settings.TEST:
|
||||
return
|
||||
for spec in instance.schedule_specs:
|
||||
spec.rel_obj = instance
|
||||
schedule = spec.update_or_create()
|
||||
|
||||
@ -11,6 +11,7 @@ from authentik.sources.ldap.models import LDAPSource, LDAPSourcePropertyMapping
|
||||
from authentik.sources.ldap.sync.groups import GroupLDAPSynchronizer
|
||||
from authentik.sources.ldap.sync.membership import MembershipLDAPSynchronizer
|
||||
from authentik.sources.ldap.sync.users import UserLDAPSynchronizer
|
||||
from authentik.tasks.models import Task
|
||||
from tests.e2e.utils import SeleniumTestCase, retry
|
||||
|
||||
|
||||
@ -93,9 +94,9 @@ class TestSourceLDAPSamba(SeleniumTestCase):
|
||||
managed="goauthentik.io/sources/ldap/default-name"
|
||||
)
|
||||
)
|
||||
GroupLDAPSynchronizer(source).sync_full()
|
||||
UserLDAPSynchronizer(source).sync_full()
|
||||
MembershipLDAPSynchronizer(source).sync_full()
|
||||
GroupLDAPSynchronizer(source, Task()).sync_full()
|
||||
UserLDAPSynchronizer(source, Task()).sync_full()
|
||||
MembershipLDAPSynchronizer(source, Task()).sync_full()
|
||||
self.assertIsNotNone(User.objects.get(username="bob"))
|
||||
self.assertIsNotNone(User.objects.get(username="james"))
|
||||
self.assertIsNotNone(User.objects.get(username="john"))
|
||||
|
||||
Reference in New Issue
Block a user