From e7044cdbfc3a07cdd5ead0d9e53a96ff21a7d263 Mon Sep 17 00:00:00 2001 From: Salomon Popp Date: Tue, 27 Feb 2024 11:54:07 +0000 Subject: [PATCH] Refactor test --- tests/test_oauth.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tests/test_oauth.py b/tests/test_oauth.py index 5671727..1641baa 100644 --- a/tests/test_oauth.py +++ b/tests/test_oauth.py @@ -88,12 +88,11 @@ def test_login_redirect(self, client: TestClient, keycloak: KeycloakAdmin): assert response.url.port == keycloak_base_url.port assert response.url.path == "/realms/bakdata/protocol/openid-connect/auth" assert response.url.params["client_id"] == "test-client" - assert response.url.params["redirect_uri"] - assert URL(response.url.params["redirect_uri"]).path == "/auth/callback" - assert URL(response.url.params["redirect_uri"]) == client.base_url.copy_with( - path="/auth/callback" - ) + redirect_uri = URL(response.url.params["redirect_uri"]) + assert redirect_uri.hostname == client.base_url.host + assert redirect_uri.path == "/auth/callback" + # call Keycloak response = httpx.get(response.url) assert response.status_code == status.HTTP_200_OK