Updates to allow tests to run against a remote RaSCSI instance

This commit is contained in:
nucleogenic 2022-09-20 00:33:47 +01:00
parent 1a15c4c648
commit 8062e5f5d7
No known key found for this signature in database
GPG Key ID: 04A5E4E319C4271D
2 changed files with 16 additions and 3 deletions

View File

@ -823,7 +823,7 @@ def test_show_logs(http_client):
)
assert response.status_code == 200
assert response.text == "-- No entries --\n"
assert response.headers["content-type"] == "text/plain"
# route("/config/load", methods=["POST"])

View File

@ -4,15 +4,28 @@ import requests
def pytest_addoption(parser):
parser.addoption("--base_url", action="store", default="http://localhost:8080")
parser.addoption("--httpserver_host", action="store", default="host.docker.internal")
parser.addoption("--httpserver_listen_address", action="store", default="127.0.0.1")
parser.addoption("--rascsi_username", action="store", default="pi")
parser.addoption("--rascsi_password", action="store", default="rascsi")
@pytest.fixture(scope="session")
def httpserver_listen_address(pytestconfig):
return (pytestconfig.getoption("httpserver_listen_address"), 0)
@pytest.fixture(scope="function", autouse=True)
def set_httpserver_hostname(httpserver):
def set_httpserver_hostname(pytestconfig, httpserver):
# The HTTP requests are made by Python from within the container so we need
# httpserver.url_for to generate URLs which point to the Docker host
httpserver.host = "host.docker.internal"
httpserver.host = pytestconfig.getoption("httpserver_host")
@pytest.fixture(scope="session", autouse=True)
def ensure_all_devices_detached(create_http_client):
http_client = create_http_client()
http_client.post("/scsi/detach_all")
@pytest.fixture(scope="session")