tests/e2e: fix ldap tests following #10270 (cherry-pick #10288) (#10703)

tests/e2e: fix ldap tests following #10270 (#10288)

Co-authored-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
This commit is contained in:
gcp-cherry-pick-bot[bot]
2024-07-31 16:01:32 +02:00
committed by GitHub
parent 6c159d120b
commit cd581efacd

View File

@ -5,7 +5,6 @@ from time import sleep
from docker.client import DockerClient, from_env
from docker.models.containers import Container
from guardian.shortcuts import get_anonymous_user
from ldap3 import ALL, ALL_ATTRIBUTES, ALL_OPERATIONAL_ATTRIBUTES, SUBTREE, Connection, Server
from ldap3.core.exceptions import LDAPInvalidCredentialsResult
@ -180,15 +179,13 @@ class TestProviderLDAP(SeleniumTestCase):
)
with self.assertRaises(LDAPInvalidCredentialsResult):
_connection.bind()
anon = get_anonymous_user()
self.assertTrue(
Event.objects.filter(
action=EventAction.LOGIN_FAILED,
user={
"pk": anon.pk,
"email": anon.email,
"username": anon.username,
"is_anonymous": True,
"pk": self.user.pk,
"email": self.user.email,
"username": self.user.username,
},
).exists(),
)