add marker to rest_cherrypy intergration tests, in first step to testing not setting netapi_clients setting

This commit is contained in:
Thomas Phipps 2023-03-09 18:29:37 +00:00 committed by Pedro Algarvio
parent 9c97514bda
commit 9f1d251e0a
4 changed files with 16 additions and 2 deletions

View file

@ -8,9 +8,13 @@ cherrypy = pytest.importorskip("cherrypy")
@pytest.fixture
def client_config(client_config, netapi_port):
def client_config(client_config, netapi_port, request):
client_config["rest_cherrypy"] = {"port": netapi_port, "debug": True}
client_config["netapi_enable_clients"] = ["local", "runner"]
marker = request.node.get_closest_marker("netapi_client_data")
if marker is None:
client_config["netapi_enable_clients"] = []
else:
client_config["netapi_enable_clients"] = marker.args[0]
return client_config

View file

@ -6,6 +6,7 @@ import salt.utils.json
@pytest.mark.slow_test
@pytest.mark.netapi_client_data(["local", "runner"])
async def test_accepts_arg_kwarg_keys(
http_client, auth_creds, content_type_map, subtests
):

View file

@ -4,6 +4,7 @@ import salt.utils.json
@pytest.mark.slow_test
@pytest.mark.netapi_client_data(["local", "runner"])
async def test_all_jobs(http_client, auth_creds, content_type_map):
"""
test query to /jobs returns job data

View file

@ -5,6 +5,7 @@ import pytest
from salt.ext.tornado.httpclient import HTTPError
@pytest.mark.netapi_client_data(["local"])
async def test_run_good_login(http_client, auth_creds):
"""
Test the run URL with good auth credentials
@ -16,6 +17,7 @@ async def test_run_good_login(http_client, auth_creds):
assert response.code == 200
@pytest.mark.netapi_client_data(["local"])
async def test_run_bad_login(http_client):
"""
Test the run URL with bad auth credentials
@ -36,6 +38,7 @@ async def test_run_bad_login(http_client):
assert exc.value.code == 401
@pytest.mark.netapi_client_data(["local"])
async def test_run_empty_token(http_client):
"""
Test the run URL with empty token
@ -51,6 +54,7 @@ async def test_run_empty_token(http_client):
assert exc.value.code == 401
@pytest.mark.netapi_client_data(["local"])
async def test_run_empty_token_upercase(http_client):
"""
Test the run URL with empty token with upercase characters
@ -66,6 +70,7 @@ async def test_run_empty_token_upercase(http_client):
assert exc.value.code == 401
@pytest.mark.netapi_client_data(["local"])
async def test_run_wrong_token(http_client):
"""
Test the run URL with incorrect token
@ -81,6 +86,7 @@ async def test_run_wrong_token(http_client):
assert exc.value.code == 401
@pytest.mark.netapi_client_data(["local"])
async def test_run_pathname_token(http_client):
"""
Test the run URL with path that exists in token
@ -101,6 +107,7 @@ async def test_run_pathname_token(http_client):
assert exc.value.code == 401
@pytest.mark.netapi_client_data(["local"])
async def test_run_pathname_not_exists_token(http_client):
"""
Test the run URL with path that does not exist in token
@ -122,6 +129,7 @@ async def test_run_pathname_not_exists_token(http_client):
@pytest.mark.slow_test
@pytest.mark.netapi_client_data(["local"])
async def test_run_extra_parameters(http_client, auth_creds):
"""
Test the run URL with good auth credentials