diff --git a/authentik/providers/scim/tasks.py b/authentik/providers/scim/tasks.py index 0480730fb..2b05af550 100644 --- a/authentik/providers/scim/tasks.py +++ b/authentik/providers/scim/tasks.py @@ -35,7 +35,7 @@ def client_for_model(provider: SCIMProvider, model: Model) -> SCIMClient: @CELERY_APP.task() def scim_sync_all(): """Run sync for all providers""" - for provider in SCIMProvider.objects.all(backchannel_application__isnull=False): + for provider in SCIMProvider.objects.filter(backchannel_application__isnull=False): scim_sync.delay(provider.pk) diff --git a/authentik/providers/scim/tests/test_client.py b/authentik/providers/scim/tests/test_client.py index d6a523192..2e298cb1b 100644 --- a/authentik/providers/scim/tests/test_client.py +++ b/authentik/providers/scim/tests/test_client.py @@ -7,6 +7,7 @@ from authentik.core.models import Application from authentik.lib.generators import generate_id from authentik.providers.scim.clients.base import SCIMClient from authentik.providers.scim.models import SCIMMapping, SCIMProvider +from authentik.providers.scim.tasks import scim_sync_all class SCIMClientTests(TestCase): @@ -82,3 +83,7 @@ class SCIMClientTests(TestCase): SCIMClient(self.provider) self.assertEqual(mock.call_count, 1) self.assertEqual(mock.request_history[0].method, "GET") + + def test_scim_sync_all(self): + """test scim_sync_all task""" + scim_sync_all() diff --git a/tests/e2e/test_provider_proxy.py b/tests/e2e/test_provider_proxy.py index 7089eeaed..684a47611 100644 --- a/tests/e2e/test_provider_proxy.py +++ b/tests/e2e/test_provider_proxy.py @@ -74,7 +74,7 @@ class TestProviderProxy(SeleniumTestCase): self.user.save() proxy: ProxyProvider = ProxyProvider.objects.create( - name="proxy_provider", + name=generate_id(), authorization_flow=Flow.objects.get( slug="default-provider-authorization-implicit-consent" ), @@ -85,9 +85,9 @@ class TestProviderProxy(SeleniumTestCase): proxy.set_oauth_defaults() proxy.save() # we need to create an application to actually access the proxy - Application.objects.create(name="proxy", slug="proxy", provider=proxy) + Application.objects.create(name=generate_id(), slug=generate_id(), provider=proxy) outpost: Outpost = Outpost.objects.create( - name="proxy_outpost", + name=generate_id(), type=OutpostType.PROXY, ) outpost.providers.add(proxy) @@ -141,7 +141,7 @@ class TestProviderProxy(SeleniumTestCase): self.user.save() proxy: ProxyProvider = ProxyProvider.objects.create( - name="proxy_provider", + name=generate_id(), authorization_flow=Flow.objects.get( slug="default-provider-authorization-implicit-consent" ), @@ -155,9 +155,9 @@ class TestProviderProxy(SeleniumTestCase): proxy.set_oauth_defaults() proxy.save() # we need to create an application to actually access the proxy - Application.objects.create(name="proxy", slug="proxy", provider=proxy) + Application.objects.create(name=generate_id(), slug=generate_id(), provider=proxy) outpost: Outpost = Outpost.objects.create( - name="proxy_outpost", + name=generate_id(), type=OutpostType.PROXY, ) outpost.providers.add(proxy) @@ -219,7 +219,7 @@ class TestProviderProxyConnect(ChannelsLiveServerTestCase): proxy.set_oauth_defaults() proxy.save() # we need to create an application to actually access the proxy - Application.objects.create(name="proxy", slug="proxy", provider=proxy) + Application.objects.create(name=generate_id(), slug=generate_id(), provider=proxy) service_connection = DockerServiceConnection.objects.get(local=True) outpost: Outpost = Outpost.objects.create( name=generate_id(),