tests/e2e: test additionalHeaders with proxy

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-06-18 18:42:03 +02:00
parent 932cf48d2b
commit 405c690193
1 changed files with 13 additions and 1 deletions

View File

@ -21,7 +21,13 @@ from authentik.outposts.models import (
)
from authentik.outposts.tasks import outpost_local_connection
from authentik.providers.proxy.models import ProxyProvider
from tests.e2e.utils import SeleniumTestCase, apply_migration, object_manager, retry
from tests.e2e.utils import (
USER,
SeleniumTestCase,
apply_migration,
object_manager,
retry,
)
@skipUnless(platform.startswith("linux"), "requires local docker")
@ -67,6 +73,11 @@ class TestProviderProxy(SeleniumTestCase):
@object_manager
def test_proxy_simple(self):
"""Test simple outpost setup with single provider"""
# set additionalHeaders to test later
user = USER()
user.attributes["additionalHeaders"] = {"X-Foo": "bar"}
user.save()
proxy: ProxyProvider = ProxyProvider.objects.create(
name="proxy_provider",
authorization_flow=Flow.objects.get(
@ -106,6 +117,7 @@ class TestProviderProxy(SeleniumTestCase):
full_body_text = self.driver.find_element(By.CSS_SELECTOR, "pre").text
self.assertIn("X-Forwarded-Preferred-Username: akadmin", full_body_text)
self.assertIn("X-Foo: bar", full_body_text)
@skipUnless(platform.startswith("linux"), "requires local docker")