-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
19 changes: 19 additions & 0 deletions
19
testsuite/tests/kuadrant/authorino/identity/rhsso/multiple_hosts/conftest.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,19 @@ | ||
"""Conftest for multiple hosts tests""" | ||
import pytest | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
def hostname(envoy): | ||
"""Original hostname""" | ||
return envoy.hostname | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
def second_hostname(envoy, blame): | ||
"""Second valid hostname""" | ||
service_name = envoy.route.model.spec.to.name | ||
route = envoy.openshift.do_action("expose", "service", f"--name={blame('second')}", "-o", "json", | ||
service_name, parse_output=True) | ||
yield route.model.spec.host | ||
with envoy.openshift.context: | ||
route.delete(ignore_not_found=True) |
24 changes: 24 additions & 0 deletions
24
testsuite/tests/kuadrant/authorino/identity/rhsso/multiple_hosts/test_multiple_hosts.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,24 @@ | ||
"""Tests AuthConfig with multiple specified hosts""" | ||
import pytest | ||
|
||
from testsuite.httpx import HttpxBackoffClient | ||
|
||
|
||
@pytest.fixture(scope="module") | ||
def authorization(authorization, second_hostname): | ||
"""Adds second host to the AuthConfig""" | ||
authorization.add_host(second_hostname) | ||
return authorization | ||
|
||
|
||
def test_original_host(client, auth): | ||
"""Tests correct host""" | ||
response = client.get("/get", auth=auth) | ||
assert response.status_code == 200 | ||
|
||
|
||
def test_second_host(client, auth, second_hostname): | ||
"""Tests correct host""" | ||
client = HttpxBackoffClient(base_url=f"http://{second_hostname}") | ||
response = client.get("/get", auth=auth) | ||
assert response.status_code == 200 |