cleanup, restart loop when we finished an operation
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
@ -1,7 +0,0 @@
|
|||||||
# #Test files for OpenID Conformance testing.
|
|
||||||
|
|
||||||
These config files assume testing is being done using the [OpenID Conformance Suite](https://openid.net/certification/about-conformance-suite/), locally.
|
|
||||||
|
|
||||||
See https://gitlab.com/openid/conformance-suite/-/wikis/Developers/Build-&-Run for running the conformance suite locally.
|
|
||||||
|
|
||||||
Requires docker containers to be able to access the host via `host.docker.internal` and an entry in the hosts file that maps `host.docker.internal` to localhost.
|
|
||||||
@ -1,11 +1,13 @@
|
|||||||
from json import dumps
|
from json import dumps
|
||||||
from time import sleep
|
from time import sleep
|
||||||
|
|
||||||
|
from selenium.webdriver.common.by import By
|
||||||
|
from selenium.webdriver.support import expected_conditions as ec
|
||||||
|
|
||||||
from authentik.blueprints.tests import apply_blueprint, reconcile_app
|
from authentik.blueprints.tests import apply_blueprint, reconcile_app
|
||||||
|
from authentik.providers.oauth2.models import OAuth2Provider
|
||||||
from tests.e2e.utils import SeleniumTestCase, retry
|
from tests.e2e.utils import SeleniumTestCase, retry
|
||||||
from tests.openid_conformance.conformance import Conformance
|
from tests.openid_conformance.conformance import Conformance
|
||||||
from selenium.webdriver.common.by import By
|
|
||||||
|
|
||||||
from selenium.webdriver.support import expected_conditions as ec
|
|
||||||
|
|
||||||
|
|
||||||
class TestOpenIDConformance(SeleniumTestCase):
|
class TestOpenIDConformance(SeleniumTestCase):
|
||||||
@ -26,27 +28,31 @@ class TestOpenIDConformance(SeleniumTestCase):
|
|||||||
@apply_blueprint("testing/oidc-conformance.yaml")
|
@apply_blueprint("testing/oidc-conformance.yaml")
|
||||||
def test_oidcc_basic_certification_test(self):
|
def test_oidcc_basic_certification_test(self):
|
||||||
test_plan_name = "oidcc-basic-certification-test-plan"
|
test_plan_name = "oidcc-basic-certification-test-plan"
|
||||||
test_variant_config = {
|
provider_a = OAuth2Provider.objects.get(
|
||||||
"server_metadata": "discovery",
|
client_id="4054d882aff59755f2f279968b97ce8806a926e1"
|
||||||
"client_registration": "static_client",
|
)
|
||||||
}
|
provider_b = OAuth2Provider.objects.get(
|
||||||
|
client_id="ad64aeaf1efe388ecf4d28fcc537e8de08bcae26"
|
||||||
|
)
|
||||||
test_plan_config = {
|
test_plan_config = {
|
||||||
"alias": "authentik",
|
"alias": "authentik",
|
||||||
"description": "authentik",
|
"description": "authentik",
|
||||||
"server": {
|
"server": {
|
||||||
"discoveryUrl": f"{self.live_server_url}/application/o/conformance/.well-known/openid-configuration"
|
"discoveryUrl": self.url(
|
||||||
|
"authentik_providers_oauth2:provider-info", application_slug="conformance"
|
||||||
|
),
|
||||||
},
|
},
|
||||||
"client": {
|
"client": {
|
||||||
"client_id": "4054d882aff59755f2f279968b97ce8806a926e1",
|
"client_id": "4054d882aff59755f2f279968b97ce8806a926e1",
|
||||||
"client_secret": "4c7e4933009437fb486b5389d15b173109a0555dc47e0cc0949104f1925bcc6565351cb1dffd7e6818cf074f5bd50c210b565121a7328ee8bd40107fc4bbd867",
|
"client_secret": provider_a.client_secret,
|
||||||
},
|
},
|
||||||
"client_secret_post": {
|
"client_secret_post": {
|
||||||
"client_id": "4054d882aff59755f2f279968b97ce8806a926e1",
|
"client_id": "4054d882aff59755f2f279968b97ce8806a926e1",
|
||||||
"client_secret": "4c7e4933009437fb486b5389d15b173109a0555dc47e0cc0949104f1925bcc6565351cb1dffd7e6818cf074f5bd50c210b565121a7328ee8bd40107fc4bbd867",
|
"client_secret": provider_a.client_secret,
|
||||||
},
|
},
|
||||||
"client2": {
|
"client2": {
|
||||||
"client_id": "ad64aeaf1efe388ecf4d28fcc537e8de08bcae26",
|
"client_id": "ad64aeaf1efe388ecf4d28fcc537e8de08bcae26",
|
||||||
"client_secret": "ff2e34a5b04c99acaf7241e25a950e7f6134c86936923d8c698d8f38bd57647750d661069612c0ee55045e29fe06aa101804bdae38e8360647d595e771fea789",
|
"client_secret": provider_b.client_secret,
|
||||||
},
|
},
|
||||||
"consent": {},
|
"consent": {},
|
||||||
}
|
}
|
||||||
@ -55,7 +61,12 @@ class TestOpenIDConformance(SeleniumTestCase):
|
|||||||
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, dumps(test_plan_config), test_variant_config
|
test_plan_name,
|
||||||
|
dumps(test_plan_config),
|
||||||
|
{
|
||||||
|
"server_metadata": "discovery",
|
||||||
|
"client_registration": "static_client",
|
||||||
|
},
|
||||||
)
|
)
|
||||||
plan_id = test_plan["id"]
|
plan_id = test_plan["id"]
|
||||||
for test in test_plan["modules"]:
|
for test in test_plan["modules"]:
|
||||||
@ -72,6 +83,7 @@ class TestOpenIDConformance(SeleniumTestCase):
|
|||||||
sleep(2)
|
sleep(2)
|
||||||
|
|
||||||
def run_test(self, module_id: str):
|
def run_test(self, module_id: str):
|
||||||
|
"""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
|
||||||
while True:
|
while True:
|
||||||
@ -88,6 +100,7 @@ class TestOpenIDConformance(SeleniumTestCase):
|
|||||||
if len(browser_urls) > tested_browser_url:
|
if len(browser_urls) > tested_browser_url:
|
||||||
self.do_browser(browser_urls[tested_browser_url])
|
self.do_browser(browser_urls[tested_browser_url])
|
||||||
tested_browser_url += 1
|
tested_browser_url += 1
|
||||||
|
continue
|
||||||
# Check if we need to upload any items
|
# Check if we need to upload any items
|
||||||
upload_items = [x for x in test_log if "upload" in x]
|
upload_items = [x for x in test_log if "upload" in x]
|
||||||
if len(upload_items) > uploaded_image:
|
if len(upload_items) > uploaded_image:
|
||||||
@ -97,6 +110,7 @@ class TestOpenIDConformance(SeleniumTestCase):
|
|||||||
)
|
)
|
||||||
sleep(3)
|
sleep(3)
|
||||||
uploaded_image += 1
|
uploaded_image += 1
|
||||||
|
continue
|
||||||
if test_info["status"] in ["INTERRUPTED", "FINISHED"]:
|
if test_info["status"] in ["INTERRUPTED", "FINISHED"]:
|
||||||
return
|
return
|
||||||
sleep(0.1)
|
sleep(0.1)
|
||||||
|
|||||||
Reference in New Issue
Block a user