From 28fd1dcf66a28b0c8fed2e86e2c005a35aa8a193 Mon Sep 17 00:00:00 2001 From: Alex Zgabur Date: Mon, 6 Nov 2023 10:53:38 +0100 Subject: [PATCH] Fix wrong credentials param api_key/test_auth_credentials.py --- .../identity/api_key/test_auth_credentials.py | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/testsuite/tests/kuadrant/authorino/identity/api_key/test_auth_credentials.py b/testsuite/tests/kuadrant/authorino/identity/api_key/test_auth_credentials.py index f0a42151..26e0c7ab 100644 --- a/testsuite/tests/kuadrant/authorino/identity/api_key/test_auth_credentials.py +++ b/testsuite/tests/kuadrant/authorino/identity/api_key/test_auth_credentials.py @@ -21,23 +21,35 @@ def authorization(authorization, api_key, credentials): def test_custom_selector(client, auth, credentials): """Test if auth credentials are stored in right place""" response = client.get("/get", headers={"authorization": "API_KEY " + auth.api_key}) - assert response.status_code == 200 if credentials == "authorization_header" else 401 + if credentials == "authorizationHeader": + assert response.status_code == 200 + else: + assert response.status_code == 401 def test_custom_header(client, auth, credentials): """Test if auth credentials are stored in right place""" response = client.get("/get", headers={"API_KEY": auth.api_key}) - assert response.status_code == 200 if credentials == "custom_header" else 401 + if credentials == "customHeader": + assert response.status_code == 200 + else: + assert response.status_code == 401 def test_query(client, auth, credentials): """Test if auth credentials are stored in right place""" response = client.get("/get", params={"API_KEY": auth.api_key}) - assert response.status_code == 200 if credentials == "query" else 401 + if credentials == "queryString": + assert response.status_code == 200 + else: + assert response.status_code == 401 def test_cookie(route, auth, credentials): """Test if auth credentials are stored in right place""" with route.client(cookies={"API_KEY": auth.api_key}) as client: response = client.get("/get") - assert response.status_code == 200 if credentials == "cookie" else 401 + if credentials == "cookie": + assert response.status_code == 200 + else: + assert response.status_code == 401