From 17424ccc3b0dd0f147e727a93a7c6c01dab82c83 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Sat, 20 Jun 2020 17:06:15 +0200 Subject: [PATCH] e2e: use reverse instead of static URLs --- e2e/test_provider_oidc.py | 12 ++++++------ e2e/utils.py | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/e2e/test_provider_oidc.py b/e2e/test_provider_oidc.py index 127f6fd40..9a3d4e598 100644 --- a/e2e/test_provider_oidc.py +++ b/e2e/test_provider_oidc.py @@ -2,6 +2,7 @@ from time import sleep from django.contrib.staticfiles.testing import StaticLiveServerTestCase +from django.shortcuts import reverse from oauth2_provider.generators import generate_client_id, generate_client_secret from oidc_provider.models import Client, ResponseType from selenium import webdriver @@ -33,7 +34,7 @@ class TestProviderOIDC(SeleniumTestCase): container = client.containers.run( image="grafana/grafana:latest", detach=True, - name=f"passbook-e2e-grafana-client_{self.port}", + name="passbook-e2e-grafana-client", network_mode="host", auto_remove=True, healthcheck=Healthcheck( @@ -47,13 +48,13 @@ class TestProviderOIDC(SeleniumTestCase): "GF_AUTH_GENERIC_OAUTH_CLIENT_SECRET": self.client_secret, "GF_AUTH_GENERIC_OAUTH_SCOPES": "openid email profile", "GF_AUTH_GENERIC_OAUTH_AUTH_URL": ( - f"{self.live_server_url}/application/oidc/authorize" + self.live_server_url + reverse("passbook_providers_oidc:authorize") ), "GF_AUTH_GENERIC_OAUTH_TOKEN_URL": ( - f"{self.live_server_url}/application/oidc/token" + self.live_server_url + reverse("oidc_provider:token") ), "GF_AUTH_GENERIC_OAUTH_API_URL": ( - f"{self.live_server_url}/application/oidc/userinfo" + self.live_server_url + reverse("oidc_provider:userinfo") ), "GF_LOG_LEVEL": "debug", }, @@ -66,9 +67,8 @@ class TestProviderOIDC(SeleniumTestCase): sleep(1) def tearDown(self): - super().tearDown() - self.driver.quit() self.container.kill() + super().tearDown() def test_redirect_uri_error(self): """test OpenID Provider flow (invalid redirect URI, check error message)""" diff --git a/e2e/utils.py b/e2e/utils.py index 61fdf9b1b..7577ac581 100644 --- a/e2e/utils.py +++ b/e2e/utils.py @@ -39,8 +39,8 @@ class SeleniumTestCase(StaticLiveServerTestCase): ) def tearDown(self): - super().tearDown() self.driver.quit() + super().tearDown() def apply_default_data(self): """apply objects created by migrations after tables have been truncated"""