From e4a0345231175b7c505a41550f9a8d74cb9a1a0b Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Mon, 15 Nov 2021 22:37:36 +0100 Subject: [PATCH] tests/integration: use channels test server Signed-off-by: Jens Langhammer --- tests/integration/test_outpost_docker.py | 18 +++++++++++++----- tests/integration/test_proxy_docker.py | 18 +++++++++++++----- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/tests/integration/test_outpost_docker.py b/tests/integration/test_outpost_docker.py index 7fe505c53..4e739f9a6 100644 --- a/tests/integration/test_outpost_docker.py +++ b/tests/integration/test_outpost_docker.py @@ -4,22 +4,27 @@ from tempfile import mkdtemp from time import sleep import yaml -from django.test import TestCase +from channels.testing import ChannelsLiveServerTestCase from docker import DockerClient, from_env from docker.models.containers import Container from docker.types.healthcheck import Healthcheck from authentik import __version__ from authentik.crypto.models import CertificateKeyPair -from authentik.flows.models import Flow +from authentik.flows.models import Flow, FlowDesignation from authentik.outposts.controllers.docker import DockerController -from authentik.outposts.models import DockerServiceConnection, Outpost, OutpostType +from authentik.outposts.models import ( + DockerServiceConnection, + Outpost, + OutpostType, + default_outpost_config, +) from authentik.outposts.tasks import outpost_local_connection from authentik.providers.proxy.models import ProxyProvider from tests.e2e.utils import get_docker_tag -class OutpostDockerTests(TestCase): +class OutpostDockerTests(ChannelsLiveServerTestCase): """Test Docker Controllers""" def _start_container(self, ssl_folder: str) -> Container: @@ -59,7 +64,9 @@ class OutpostDockerTests(TestCase): name="test", internal_host="http://localhost", external_host="http://localhost", - authorization_flow=Flow.objects.first(), + authorization_flow=Flow.objects.create( + name="foo", slug="foo", designation=FlowDesignation.AUTHORIZATION + ), ) authentication_kp = CertificateKeyPair.objects.create( name="docker-authentication", @@ -82,6 +89,7 @@ class OutpostDockerTests(TestCase): name="test", type=OutpostType.PROXY, service_connection=self.service_connection, + _config=default_outpost_config(self.live_server_url), ) self.outpost.providers.add(self.provider) self.outpost.save() diff --git a/tests/integration/test_proxy_docker.py b/tests/integration/test_proxy_docker.py index 88997627e..f5649ebee 100644 --- a/tests/integration/test_proxy_docker.py +++ b/tests/integration/test_proxy_docker.py @@ -4,22 +4,27 @@ from tempfile import mkdtemp from time import sleep import yaml -from django.test import TestCase +from channels.testing.live import ChannelsLiveServerTestCase from docker import DockerClient, from_env from docker.models.containers import Container from docker.types.healthcheck import Healthcheck from authentik import __version__ from authentik.crypto.models import CertificateKeyPair -from authentik.flows.models import Flow -from authentik.outposts.models import DockerServiceConnection, Outpost, OutpostType +from authentik.flows.models import Flow, FlowDesignation +from authentik.outposts.models import ( + DockerServiceConnection, + Outpost, + OutpostType, + default_outpost_config, +) from authentik.outposts.tasks import outpost_local_connection from authentik.providers.proxy.controllers.docker import DockerController from authentik.providers.proxy.models import ProxyProvider from tests.e2e.utils import get_docker_tag -class TestProxyDocker(TestCase): +class TestProxyDocker(ChannelsLiveServerTestCase): """Test Docker Controllers""" def _start_container(self, ssl_folder: str) -> Container: @@ -59,7 +64,9 @@ class TestProxyDocker(TestCase): name="test", internal_host="http://localhost", external_host="http://localhost", - authorization_flow=Flow.objects.first(), + authorization_flow=Flow.objects.create( + name="foo", slug="foo", designation=FlowDesignation.AUTHORIZATION + ), ) authentication_kp = CertificateKeyPair.objects.create( name="docker-authentication", @@ -82,6 +89,7 @@ class TestProxyDocker(TestCase): name="test", type=OutpostType.PROXY, service_connection=self.service_connection, + _config=default_outpost_config(self.live_server_url), ) self.outpost.providers.add(self.provider) self.outpost.save()