tests/e2e: use generated uid
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
2d9cd28221
commit
91fd792f88
|
@ -40,8 +40,5 @@ class PytestTestRunner: # pragma: no cover
|
|||
if self.keepdb:
|
||||
argv.append("--reuse-db")
|
||||
|
||||
if any("tests/e2e" in label for label in test_labels):
|
||||
argv.append("-pno:randomly")
|
||||
|
||||
argv.extend(test_labels)
|
||||
return pytest.main(argv)
|
||||
|
|
|
@ -24,7 +24,6 @@ from authentik.providers.oauth2.models import ClientTypes, OAuth2Provider, Scope
|
|||
from tests.e2e.utils import USER, SeleniumTestCase, apply_migration, object_manager, retry
|
||||
|
||||
LOGGER = get_logger()
|
||||
APPLICATION_SLUG = "grafana"
|
||||
|
||||
|
||||
@skipUnless(platform.startswith("linux"), "requires local docker")
|
||||
|
@ -34,6 +33,7 @@ class TestProviderOAuth2OAuth(SeleniumTestCase):
|
|||
def setUp(self):
|
||||
self.client_id = generate_id()
|
||||
self.client_secret = generate_key()
|
||||
self.app_slug = generate_id(20)
|
||||
super().setUp()
|
||||
|
||||
def get_container_specs(self) -> Optional[dict[str, Any]]:
|
||||
|
@ -60,7 +60,7 @@ class TestProviderOAuth2OAuth(SeleniumTestCase):
|
|||
"GF_AUTH_SIGNOUT_REDIRECT_URL": (
|
||||
self.url(
|
||||
"authentik_core:if-session-end",
|
||||
application_slug=APPLICATION_SLUG,
|
||||
application_slug=self.app_slug,
|
||||
)
|
||||
),
|
||||
"GF_LOG_LEVEL": "debug",
|
||||
|
@ -97,7 +97,7 @@ class TestProviderOAuth2OAuth(SeleniumTestCase):
|
|||
provider.save()
|
||||
Application.objects.create(
|
||||
name="Grafana",
|
||||
slug=APPLICATION_SLUG,
|
||||
slug=self.app_slug,
|
||||
provider=provider,
|
||||
)
|
||||
|
||||
|
@ -137,10 +137,9 @@ class TestProviderOAuth2OAuth(SeleniumTestCase):
|
|||
scope_name__in=[SCOPE_OPENID, SCOPE_OPENID_EMAIL, SCOPE_OPENID_PROFILE]
|
||||
)
|
||||
)
|
||||
provider.save()
|
||||
Application.objects.create(
|
||||
name="Grafana",
|
||||
slug=APPLICATION_SLUG,
|
||||
slug=self.app_slug,
|
||||
provider=provider,
|
||||
)
|
||||
|
||||
|
@ -197,7 +196,7 @@ class TestProviderOAuth2OAuth(SeleniumTestCase):
|
|||
provider.save()
|
||||
Application.objects.create(
|
||||
name="Grafana",
|
||||
slug=APPLICATION_SLUG,
|
||||
slug=self.app_slug,
|
||||
provider=provider,
|
||||
)
|
||||
|
||||
|
@ -226,7 +225,7 @@ class TestProviderOAuth2OAuth(SeleniumTestCase):
|
|||
self.wait_for_url(
|
||||
self.url(
|
||||
"authentik_core:if-session-end",
|
||||
application_slug=APPLICATION_SLUG,
|
||||
application_slug=self.app_slug,
|
||||
)
|
||||
)
|
||||
self.driver.find_element(By.ID, "logout").click()
|
||||
|
@ -262,7 +261,7 @@ class TestProviderOAuth2OAuth(SeleniumTestCase):
|
|||
provider.save()
|
||||
app = Application.objects.create(
|
||||
name="Grafana",
|
||||
slug=APPLICATION_SLUG,
|
||||
slug=self.app_slug,
|
||||
provider=provider,
|
||||
)
|
||||
|
||||
|
@ -335,7 +334,7 @@ class TestProviderOAuth2OAuth(SeleniumTestCase):
|
|||
provider.save()
|
||||
app = Application.objects.create(
|
||||
name="Grafana",
|
||||
slug=APPLICATION_SLUG,
|
||||
slug=self.app_slug,
|
||||
provider=provider,
|
||||
)
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@ from typing import Any, Optional
|
|||
from unittest.case import skipUnless
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
from django.test import override_settings
|
||||
from docker.models.containers import Container
|
||||
from docker.types import Healthcheck
|
||||
from selenium.webdriver.common.by import By
|
||||
|
@ -179,43 +178,6 @@ class TestSourceOAuth2(SeleniumTestCase):
|
|||
|
||||
self.assert_user(User(username="foo", name="admin", email="admin@example.com"))
|
||||
|
||||
@retry()
|
||||
@apply_migration("authentik_core", "0002_auto_20200523_1133_squashed_0011_provider_name_temp")
|
||||
@apply_migration("authentik_flows", "0008_default_flows")
|
||||
@apply_migration("authentik_flows", "0011_flow_title")
|
||||
@apply_migration("authentik_flows", "0009_source_flows")
|
||||
@apply_migration("authentik_crypto", "0002_create_self_signed_kp")
|
||||
@object_manager
|
||||
@override_settings(SESSION_COOKIE_SAMESITE="strict")
|
||||
def test_oauth_samesite_strict(self):
|
||||
"""test OAuth Source With SameSite set to strict
|
||||
(=will fail because session is not carried over)"""
|
||||
self.create_objects()
|
||||
self.driver.get(self.live_server_url)
|
||||
|
||||
flow_executor = self.get_shadow_root("ak-flow-executor")
|
||||
identification_stage = self.get_shadow_root("ak-stage-identification", flow_executor)
|
||||
wait = WebDriverWait(identification_stage, self.wait_timeout)
|
||||
|
||||
wait.until(
|
||||
ec.presence_of_element_located(
|
||||
(By.CSS_SELECTOR, ".pf-c-login__main-footer-links-item > button")
|
||||
)
|
||||
)
|
||||
identification_stage.find_element(
|
||||
By.CSS_SELECTOR, ".pf-c-login__main-footer-links-item > button"
|
||||
).click()
|
||||
|
||||
# Now we should be at the IDP, wait for the login field
|
||||
self.wait.until(ec.presence_of_element_located((By.ID, "login")))
|
||||
self.driver.find_element(By.ID, "login").send_keys("admin@example.com")
|
||||
self.driver.find_element(By.ID, "password").send_keys("password")
|
||||
self.driver.find_element(By.ID, "password").send_keys(Keys.ENTER)
|
||||
|
||||
# Wait until we're logged in
|
||||
self.wait.until(ec.presence_of_element_located((By.CSS_SELECTOR, "button[type=submit]")))
|
||||
self.driver.find_element(By.CSS_SELECTOR, "button[type=submit]").click()
|
||||
|
||||
@retry()
|
||||
@apply_migration("authentik_core", "0002_auto_20200523_1133_squashed_0011_provider_name_temp")
|
||||
@apply_migration("authentik_flows", "0008_default_flows")
|
||||
|
|
Reference in New Issue