-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
No-Issue Signed-off-by: James Tanner <[email protected]>
- Loading branch information
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
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,39 @@ | ||
import json | ||
import os | ||
import uuid | ||
|
||
import pytest | ||
|
||
|
||
pytestmark = pytest.mark.qa # noqa: F821 | ||
|
||
|
||
@pytest.mark.deployment_standalone | ||
@pytest.mark.min_hub_version("4.10dev") | ||
@pytest.mark.skipif( | ||
os.getenv("ENABLE_DAB_TESTS"), | ||
reason="Skipping test because ENABLE_DAB_TESTS is set" | ||
) | ||
def test_system_auditor_role_permissions_without_gateway(galaxy_client): | ||
"""Tests the galaxy.system_auditor role can be added to a user and has the right perms.""" | ||
|
||
gc = galaxy_client("admin", ignore_cache=True) | ||
|
||
# make a random user | ||
username = str(uuid.uuid4()) | ||
uinfo = gc.post( | ||
"_ui/v1/users/", | ||
body=json.dumps({"username": username, "password": "redhat1234"}) | ||
) | ||
uid = uinfo["id"] | ||
|
||
# assign the galaxy.system_auditor role to the user | ||
rinfo = gc.post( | ||
f"pulp/api/v3/users/{uid}/roles/", | ||
body=json.dumps({'content_object': None, 'role': 'galaxy.auditor'}) | ||
) | ||
|
||
# check that all the permssions are view_* only ... | ||
for perm_code in rinfo["permissions"]: | ||
perm_name = perm_code.split(".", 1)[1] | ||
assert "view_" in perm_name, f"{perm_code} is not a view-only permission" |