Skip to content

Commit 736043b

Browse files
committed
change: add test to add single user
1 parent bcbce95 commit 736043b

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

tests/model_registry/test_user_permission.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,47 @@ def test_create_group(
241241
subjects_kind="Group",
242242
subjects_name=NEW_GROUP_NAME,
243243
):
244+
LOGGER.info("User should have access to MR after the group is granted edit access via a RoleBinding")
245+
user_token = get_token(user_name=user_name, password=password, admin_client=admin_client)
246+
assert_mr_client(
247+
user_token=user_token,
248+
admin_client=admin_client,
249+
context=nullcontext(),
250+
mr_instance=model_registry_instance,
251+
mr_namespace_name=model_registry_namespace,
252+
)
253+
254+
@pytest.mark.smoke
255+
@pytest.mark.parametrize(
256+
"user_name, password",
257+
[
258+
("ldap-user1", os.environ.get("NON_ADMIN_PASSWORD")),
259+
],
260+
)
261+
def test_add_single_user(
262+
self: Self,
263+
updated_dsc_component_state_scope_class: Namespace,
264+
model_registry_instance: ModelRegistry,
265+
model_registry_namespace: str,
266+
admin_client: DynamicClient,
267+
user_name: str,
268+
password: str,
269+
):
270+
"""
271+
Test that adding a single user to the Model Registry's permitted list allows
272+
that user to access the Model Registry.
273+
"""
274+
275+
with RoleBinding(
276+
client=admin_client,
277+
namespace=model_registry_namespace,
278+
name="test-model-registry-access",
279+
role_ref_name="edit",
280+
role_ref_kind="ClusterRole",
281+
subjects_kind="User",
282+
subjects_name=user_name,
283+
):
284+
LOGGER.info("User should have access to MR after the RoleBinding for the user is created")
244285
user_token = get_token(user_name=user_name, password=password, admin_client=admin_client)
245286
assert_mr_client(
246287
user_token=user_token,

0 commit comments

Comments
 (0)