Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
Jens Langhammer
2025-05-29 23:43:12 +02:00
parent ad872379e3
commit e3f5058cbe
2 changed files with 14 additions and 8 deletions

View File

@ -168,7 +168,6 @@ class Conformance:
response = self.session.post(url, data=data, headers={"Content-Type": "text/plain"}) response = self.session.post(url, data=data, headers={"Content-Type": "text/plain"})
if response.status_code != Conformance.HTTP_OK: if response.status_code != Conformance.HTTP_OK:
raise Exception(f"upload_image failed - HTTP {response.status_code} {response.content}") raise Exception(f"upload_image failed - HTTP {response.status_code} {response.content}")
return response.json()
def start_test(self, module_id): def start_test(self, module_id):
url = f"{self.api_url_base}api/runner/{module_id}" url = f"{self.api_url_base}api/runner/{module_id}"

View File

@ -1,4 +1,5 @@
from json import dumps from json import dumps
from os import makedirs
from pathlib import Path from pathlib import Path
from time import sleep from time import sleep
@ -15,7 +16,6 @@ class TestOpenIDConformance(SeleniumTestCase):
conformance: Conformance conformance: Conformance
@retry()
@apply_blueprint( @apply_blueprint(
"default/flow-default-authentication-flow.yaml", "default/flow-default-authentication-flow.yaml",
"default/flow-default-invalidation-flow.yaml", "default/flow-default-invalidation-flow.yaml",
@ -27,15 +27,16 @@ class TestOpenIDConformance(SeleniumTestCase):
@apply_blueprint("system/providers-oauth2.yaml") @apply_blueprint("system/providers-oauth2.yaml")
@reconcile_app("authentik_crypto") @reconcile_app("authentik_crypto")
@apply_blueprint("testing/oidc-conformance.yaml") @apply_blueprint("testing/oidc-conformance.yaml")
def test_oidcc_basic_certification_test(self): def setUp(self):
test_plan_name = "oidcc-basic-certification-test-plan" super().setUp()
makedirs(Path(__file__).parent / "exports", exist_ok=True)
provider_a = OAuth2Provider.objects.get( provider_a = OAuth2Provider.objects.get(
client_id="4054d882aff59755f2f279968b97ce8806a926e1" client_id="4054d882aff59755f2f279968b97ce8806a926e1"
) )
provider_b = OAuth2Provider.objects.get( provider_b = OAuth2Provider.objects.get(
client_id="ad64aeaf1efe388ecf4d28fcc537e8de08bcae26" client_id="ad64aeaf1efe388ecf4d28fcc537e8de08bcae26"
) )
test_plan_config = { self.test_plan_config = {
"alias": "authentik", "alias": "authentik",
"description": "authentik", "description": "authentik",
"server": { "server": {
@ -58,11 +59,17 @@ class TestOpenIDConformance(SeleniumTestCase):
"consent": {}, "consent": {},
} }
@retry()
def test_oidcc_basic_certification_test(self):
test_plan_name = "oidcc-basic-certification-test-plan"
self.run_test(test_plan_name, self.test_plan_config)
def run_test(self, test_plan: str, test_plan_config: dict):
# Create a Conformance instance... # Create a Conformance instance...
self.conformance = Conformance(f"https://{self.host}:8443/", None, verify_ssl=False) self.conformance = Conformance(f"https://{self.host}:8443/", None, verify_ssl=False)
test_plan = self.conformance.create_test_plan( test_plan = self.conformance.create_test_plan(
test_plan_name, test_plan,
dumps(test_plan_config), dumps(test_plan_config),
{ {
"server_metadata": "discovery", "server_metadata": "discovery",
@ -79,12 +86,12 @@ class TestOpenIDConformance(SeleniumTestCase):
plan_id, module_name, variant plan_id, module_name, variant
) )
module_id = module_instance["id"] module_id = module_instance["id"]
self.run_test(module_id) self.run_single_test(module_id)
self.conformance.wait_for_state(module_id, ["FINISHED"], timeout=self.wait_timeout) self.conformance.wait_for_state(module_id, ["FINISHED"], timeout=self.wait_timeout)
sleep(2) sleep(2)
self.conformance.exporthtml(plan_id, Path(__file__).parent / "exports") self.conformance.exporthtml(plan_id, Path(__file__).parent / "exports")
def run_test(self, module_id: str): def run_single_test(self, module_id: str):
"""Process instructions for a single test, navigate to browser URLs and take screenshots""" """Process instructions for a single test, navigate to browser URLs and take screenshots"""
tested_browser_url = 0 tested_browser_url = 0
uploaded_image = 0 uploaded_image = 0