-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #67 from JaurbanRH/multiple_auth
Multiple auth identities
- Loading branch information
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
testsuite/tests/kuadrant/authorino/identity/auth/test_multiple_auth_identities.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
""" | ||
Tests for multiple auth identities (RHSSO + Auth0) | ||
""" | ||
|
||
import pytest | ||
|
||
|
||
# pylint: disable=unused-argument | ||
@pytest.fixture(scope="module") | ||
def client(auth0_authorization, rhsso_authorization, envoy): | ||
"""Returns httpx client to be used for requests, it also commits AuthConfig""" | ||
client = envoy.client() | ||
yield client | ||
client.close() | ||
|
||
|
||
def test_correct_auth(client, auth, auth0_auth): | ||
"""Tests correct auth""" | ||
response = client.get("/get", auth=auth) | ||
assert response.status_code == 200 | ||
|
||
response = client.get("/get", auth=auth0_auth) | ||
assert response.status_code == 200 | ||
|
||
|
||
def test_no_auth(client, request): | ||
"""Tests request without any auth""" | ||
response = client.get("/get") | ||
assert response.status_code == 401 | ||
|
||
|
||
def test_wrong_auth(client, request): | ||
"""Tests request with wrong token""" | ||
response = client.get("/get", headers={"Authorization": "Bearer xyz"}) | ||
assert response.status_code == 401 |