Skip to content

Commit

Permalink
Add Multiple Hosts test
Browse files Browse the repository at this point in the history
  • Loading branch information
pehala committed Aug 2, 2022
1 parent 1f9e82d commit 700175e
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
Empty file.
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)
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

0 comments on commit 700175e

Please sign in to comment.