From 430e7b2e6b173846bcb54147fc5be015324dbcb4 Mon Sep 17 00:00:00 2001 From: jctanner Date: Thu, 28 Mar 2024 13:46:33 -0400 Subject: [PATCH] Use pytest.raises context manager for aaiindex test. (#2108) * Use pytest.raises context manager for aaiindex test. No-Issue Signed-off-by: James Tanner --- galaxy_ng/tests/integration/api/test_aiindex.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/galaxy_ng/tests/integration/api/test_aiindex.py b/galaxy_ng/tests/integration/api/test_aiindex.py index 2849ecd11a..9a565dea2f 100644 --- a/galaxy_ng/tests/integration/api/test_aiindex.py +++ b/galaxy_ng/tests/integration/api/test_aiindex.py @@ -1,4 +1,5 @@ import pytest +import requests from ..utils import ( UIClient, @@ -194,12 +195,11 @@ def test_namespace_add_list_remove_aiindex(ansible_config, namespace, pe_namespa # 7. Repeat step 2 with a basic user with UIClient(config=ansible_config("basic_user")) as uclient: # 8. Assert permission error raises - assert ( + with pytest.raises(requests.exceptions.HTTPError, match=r'.*403.*permission_denied.*'): uclient.post( "_ui/v1/ai_deny_index/namespace/", payload={"reference": namespace} - ).status_code == 403 - ) + ) with UIClient(config=ansible_config("partner_engineer")) as uclient: # 9. add to the AI Index, a namespace owned by PE