tests/e2e: fix source tests
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
69ee18e13d
commit
bfa0c46588
|
@ -15,6 +15,7 @@ from selenium.webdriver.support.wait import WebDriverWait
|
|||
from structlog.stdlib import get_logger
|
||||
from yaml import safe_dump
|
||||
|
||||
from authentik.core.models import User
|
||||
from authentik.flows.models import Flow
|
||||
from authentik.providers.oauth2.generators import (
|
||||
generate_client_id,
|
||||
|
@ -162,17 +163,7 @@ class TestSourceOAuth2(SeleniumTestCase):
|
|||
self.wait_for_url(self.if_admin_url("/library"))
|
||||
self.driver.get(self.if_admin_url("/user"))
|
||||
|
||||
self.assertEqual(
|
||||
self.driver.find_element(By.ID, "id_username").get_attribute("value"), "foo"
|
||||
)
|
||||
self.assertEqual(
|
||||
self.driver.find_element(By.ID, "id_name").get_attribute("value"),
|
||||
"admin",
|
||||
)
|
||||
self.assertEqual(
|
||||
self.driver.find_element(By.ID, "id_email").get_attribute("value"),
|
||||
"admin@example.com",
|
||||
)
|
||||
self.assert_user(User(username="foo", name="admin", email="admin@example.com"))
|
||||
|
||||
@retry()
|
||||
@apply_migration("authentik_core", "0003_default_user")
|
||||
|
@ -257,17 +248,7 @@ class TestSourceOAuth2(SeleniumTestCase):
|
|||
self.wait_for_url(self.if_admin_url("/library"))
|
||||
self.driver.get(self.if_admin_url("/user"))
|
||||
|
||||
self.assertEqual(
|
||||
self.driver.find_element(By.ID, "id_username").get_attribute("value"), "foo"
|
||||
)
|
||||
self.assertEqual(
|
||||
self.driver.find_element(By.ID, "id_name").get_attribute("value"),
|
||||
"admin",
|
||||
)
|
||||
self.assertEqual(
|
||||
self.driver.find_element(By.ID, "id_email").get_attribute("value"),
|
||||
"admin@example.com",
|
||||
)
|
||||
self.assert_user(User(username="foo", name="admin", email="admin@example.com"))
|
||||
|
||||
|
||||
@skipUnless(platform.startswith("linux"), "requires local docker")
|
||||
|
@ -361,15 +342,6 @@ class TestSourceOAuth1(SeleniumTestCase):
|
|||
self.wait_for_url(self.if_admin_url("/library"))
|
||||
self.driver.get(self.if_admin_url("/user"))
|
||||
|
||||
self.assertEqual(
|
||||
self.driver.find_element(By.ID, "id_username").get_attribute("value"),
|
||||
"example-user",
|
||||
)
|
||||
self.assertEqual(
|
||||
self.driver.find_element(By.ID, "id_name").get_attribute("value"),
|
||||
"test name",
|
||||
)
|
||||
self.assertEqual(
|
||||
self.driver.find_element(By.ID, "id_email").get_attribute("value"),
|
||||
"foo@example.com",
|
||||
self.assert_user(
|
||||
User(username="example-user", name="test name", email="foo@example.com")
|
||||
)
|
||||
|
|
|
@ -5,12 +5,14 @@ from typing import Any, Optional
|
|||
from unittest.case import skipUnless
|
||||
|
||||
from docker.types import Healthcheck
|
||||
from guardian.utils import get_anonymous_user
|
||||
from selenium.webdriver.common.by import By
|
||||
from selenium.webdriver.common.keys import Keys
|
||||
from selenium.webdriver.support import expected_conditions as ec
|
||||
from selenium.webdriver.support.wait import WebDriverWait
|
||||
from structlog.stdlib import get_logger
|
||||
|
||||
from authentik.core.models import User
|
||||
from authentik.crypto.models import CertificateKeyPair
|
||||
from authentik.flows.models import Flow
|
||||
from authentik.sources.saml.models import SAMLBindingTypes, SAMLSource
|
||||
|
@ -155,9 +157,10 @@ class TestSourceSAML(SeleniumTestCase):
|
|||
self.wait_for_url(self.if_admin_url("/library"))
|
||||
self.driver.get(self.if_admin_url("/user"))
|
||||
|
||||
# Wait until we've loaded the user info page
|
||||
self.assertNotEqual(
|
||||
self.driver.find_element(By.ID, "id_username").get_attribute("value"), ""
|
||||
self.assert_user(
|
||||
User.objects.exclude(username="akadmin")
|
||||
.exclude(pk=get_anonymous_user().pk)
|
||||
.first()
|
||||
)
|
||||
|
||||
@retry()
|
||||
|
@ -235,9 +238,10 @@ class TestSourceSAML(SeleniumTestCase):
|
|||
self.wait_for_url(self.if_admin_url("/library"))
|
||||
self.driver.get(self.if_admin_url("/user"))
|
||||
|
||||
# Wait until we've loaded the user info page
|
||||
self.assertNotEqual(
|
||||
self.driver.find_element(By.ID, "id_username").get_attribute("value"), ""
|
||||
self.assert_user(
|
||||
User.objects.exclude(username="akadmin")
|
||||
.exclude(pk=get_anonymous_user().pk)
|
||||
.first()
|
||||
)
|
||||
|
||||
@retry()
|
||||
|
@ -302,7 +306,8 @@ class TestSourceSAML(SeleniumTestCase):
|
|||
self.wait_for_url(self.if_admin_url("/library"))
|
||||
self.driver.get(self.if_admin_url("/user"))
|
||||
|
||||
# Wait until we've loaded the user info page
|
||||
self.assertNotEqual(
|
||||
self.driver.find_element(By.ID, "id_username").get_attribute("value"), ""
|
||||
self.assert_user(
|
||||
User.objects.exclude(username="akadmin")
|
||||
.exclude(pk=get_anonymous_user().pk)
|
||||
.first()
|
||||
)
|
||||
|
|
Reference in New Issue