Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions testsuite/tests/apicast/auth/rhsso/openid_rhsso/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ def staging_client(api_client):
The auth of the session is set up to none in order to test different auth methods
The auth of the request will be passed in test functions
"""
client = api_client()
client.auth = None
return client
return api_client()


@pytest.fixture(scope="module")
Expand All @@ -24,9 +22,7 @@ def production_client(prod_client):
The auth of the session is set up to none in order to test different auth methods
The auth of the request will be passed in test functions
"""
client = prod_client()
client.auth = None
return client
return prod_client()


@pytest.fixture
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def test_access_token(token):
def test_token_basic_auth(request, client_function, token):
"""Test checks if the request with access token using basic auth will fail on both apicasts"""
client = request.getfixturevalue(client_function)
client.auth = None
response = client.get("/get", headers={"authorization": "Bearer " + token})
assert response.status_code == 200

Expand All @@ -62,6 +63,7 @@ def test_token_basic_auth(request, client_function, token):
def test_token_in_query(request, client_function, token):
"""Test checks if the request with access token in query params will succeed on both apicasts."""
client = request.getfixturevalue(client_function)
client.auth = None
response = client.get("/get", params={"access_token": token})
assert response.status_code == 403

Expand All @@ -79,6 +81,7 @@ def test_token_in_query(request, client_function, token):
def test_token_headers(request, client_function, token):
"""Test checks if the request with access token using basic auth will fail on both apicasts"""
client = request.getfixturevalue(client_function)
client.auth = None
response = client.get("/get", headers={"access_token": token})
assert response.status_code == 403

Expand All @@ -96,6 +99,7 @@ def test_token_headers(request, client_function, token):
def test_invalid_token_basic_auth(request, client_function):
"""Test checks if the request with access token using basic auth will fail on both apicasts"""
client = request.getfixturevalue(client_function)
client.auth = None
response = client.get("/get", headers={"authorization": "Bearer " + "NotValidAccessToken"})
assert response.status_code == 403

Expand All @@ -113,6 +117,7 @@ def test_invalid_token_basic_auth(request, client_function):
def test_client_id_and_secret_in_query(request, client_function, application):
"""Test checks if the request with client id and client secret in the query params will fail on both apicasts"""
client = request.getfixturevalue(client_function)
client.auth = None
response = client.get(
"/get", params={"client_id": application["client_id"], "client_secret": application["client_secret"]}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def test_access_token(token):
def test_token_headers(request, client_function, token):
"""Test checks if the request with access token using headers will succeed on both apicasts"""
client = request.getfixturevalue(client_function)
client.auth = None
response = client.get("/get", headers={"access_token": token})
assert response.status_code == 200

Expand All @@ -64,6 +65,7 @@ def test_token_headers(request, client_function, token):
def test_token_in_query(request, client_function, token):
"""Test checks if the request with access token in query params will fail on both apicasts."""
client = request.getfixturevalue(client_function)
client.auth = None
response = client.get("/get", params={"access_token": token})
assert response.status_code == 403

Expand All @@ -83,6 +85,7 @@ def test_token_in_query(request, client_function, token):
def test_token_basic_auth(request, client_function, token):
"""Test checks if the request with access token using basic auth will fail on both apicasts"""
client = request.getfixturevalue(client_function)
client.auth = None
response = client.get("/get", headers={"authorization": "Bearer " + token})
assert response.status_code == 403

Expand All @@ -100,6 +103,7 @@ def test_token_basic_auth(request, client_function, token):
def test_invalid_token_in_headers(request, client_function):
"""Test checks if the request with invalid access token in headers will fail on both apicasts."""
client = request.getfixturevalue(client_function)
client.auth = None
response = client.get("/get", headers={"access_token": "NotValidAccessToken"})
assert response.status_code == 403

Expand All @@ -117,6 +121,7 @@ def test_invalid_token_in_headers(request, client_function):
def test_client_id_and_secret_in_query(request, client_function, application):
"""Test checks if the request with client id and client secret in the query params will fail on both apicasts"""
client = request.getfixturevalue(client_function)
client.auth = None
response = client.get(
"/get", params={"client_id": application["client_id"], "client_secret": application["client_secret"]}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def test_access_token(token):
def test_token_in_query(request, client_function, token):
"""Test checks if the request with access token in query params will succeed on both apicasts."""
client = request.getfixturevalue(client_function)
client.auth = None
response = client.get("/get", params={"access_token": token})
assert response.status_code == 200

Expand All @@ -64,6 +65,7 @@ def test_token_in_query(request, client_function, token):
def test_token_basic_auth(request, client_function, token):
"""Test checks if the request with access token in the basic auth will fail on both apicasts."""
client = request.getfixturevalue(client_function)
client.auth = None
response = client.get("/get", headers={"authorization": "Bearer " + token})
assert response.status_code == 403

Expand All @@ -81,6 +83,7 @@ def test_token_basic_auth(request, client_function, token):
def test_token_headers(request, client_function, token):
"""Test checks if the request with access token using headers will fail on both apicasts"""
client = request.getfixturevalue(client_function)
client.auth = None
response = client.get("/get", headers={"access_token": token})
assert response.status_code == 403

Expand All @@ -98,6 +101,7 @@ def test_token_headers(request, client_function, token):
def test_invalid_token_in_query(request, client_function):
"""Test checks if the request with invalid access token in query params will fail on both apicasts."""
client = request.getfixturevalue(client_function)
client.auth = None
response = client.get("/get", params={"access_token": "NotValidAccessToken"})
assert response.status_code == 403

Expand All @@ -115,6 +119,7 @@ def test_invalid_token_in_query(request, client_function):
def test_client_id_and_secret_in_query(request, client_function, application):
"""Test checks if the request with client id and client secret in the query params will fail on both apicasts"""
client = request.getfixturevalue(client_function)
client.auth = None
response = client.get(
"/get", params={"client_id": application["client_id"], "client_secret": application["client_secret"]}
)
Expand Down
Loading