From 9daa07c4d3f8d44a7822d241e9f30d762ff252c7 Mon Sep 17 00:00:00 2001 From: John Davis Date: Thu, 12 Sep 2024 16:56:43 -0400 Subject: [PATCH] Do not pass unnecessary arguments --- test/unit/data/model/db/test_security.py | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/test/unit/data/model/db/test_security.py b/test/unit/data/model/db/test_security.py index 63ad0e52c794..e85bbe694d08 100644 --- a/test/unit/data/model/db/test_security.py +++ b/test/unit/data/model/db/test_security.py @@ -41,7 +41,7 @@ def test_private_user_role_assoc_not_affected_by_setting_user_roles(session, mak assert user.email != private_role.name # Delete user roles - GalaxyRBACAgent(session).set_user_group_and_role_associations(user, group_ids=[], role_ids=[]) + GalaxyRBACAgent(session).set_user_group_and_role_associations(user, role_ids=[]) # association with private role is preserved verify_user_associations(user, [], [private_role]) @@ -59,7 +59,7 @@ def test_private_user_role_assoc_not_affected_by_setting_role_users(session, mak assert user.email != private_role.name # Update role users - GalaxyRBACAgent(session).set_role_user_and_group_associations(private_role, user_ids=[], group_ids=[]) + GalaxyRBACAgent(session).set_role_user_and_group_associations(private_role, user_ids=[]) # association of private role with user is preserved verify_role_associations(private_role, [user], []) @@ -71,9 +71,7 @@ def test_cannot_assign_private_roles(session, make_user_and_role, make_role): verify_user_associations(user, [], [private_role1]) # the only existing association is with the private role # Try to assign 2 more roles: regular role + another private role - GalaxyRBACAgent(session).set_user_group_and_role_associations( - user, group_ids=[], role_ids=[new_role.id, private_role2.id] - ) + GalaxyRBACAgent(session).set_user_group_and_role_associations(user, role_ids=[new_role.id, private_role2.id]) # Only regular role has been added: other private role ignored; original private role still assigned verify_user_associations(user, [], [private_role1, new_role]) @@ -219,7 +217,7 @@ def test_invalid_user(self, session, make_user_and_role, make_role, make_group): # try to set associations with pytest.raises(RequestParameterInvalidException): - GalaxyRBACAgent(session).set_group_user_and_role_associations(group, user_ids=user_ids, role_ids=[]) + GalaxyRBACAgent(session).set_group_user_and_role_associations(group, user_ids=user_ids) # verify no change assert len(group.users) == 0 @@ -241,7 +239,7 @@ def test_invalid_role(self, session, make_role, make_group): # try to set associations with pytest.raises(RequestParameterInvalidException): - GalaxyRBACAgent(session).set_group_user_and_role_associations(group, user_ids=[], role_ids=role_ids) + GalaxyRBACAgent(session).set_group_user_and_role_associations(group, role_ids=role_ids) # verify no change assert len(group.roles) == 0 @@ -483,7 +481,7 @@ def test_invalid_group(self, session, make_user_and_role, make_group): # try to set associations with pytest.raises(RequestParameterInvalidException): - GalaxyRBACAgent(session).set_user_group_and_role_associations(user, group_ids=group_ids, role_ids=[]) + GalaxyRBACAgent(session).set_user_group_and_role_associations(user, group_ids=group_ids) # verify no change assert len(user.groups) == 0 @@ -505,7 +503,7 @@ def test_invalid_role(self, session, make_user_and_role, make_role): # try to set associations with pytest.raises(RequestParameterInvalidException): - GalaxyRBACAgent(session).set_user_group_and_role_associations(user, group_ids=[], role_ids=role_ids) + GalaxyRBACAgent(session).set_user_group_and_role_associations(user, role_ids=role_ids) # verify no change assert len(user.roles) == 1 # one is the private role association @@ -743,7 +741,7 @@ def test_invalid_user(self, session, make_role, make_user_and_role): # try to set associations with pytest.raises(RequestParameterInvalidException): - GalaxyRBACAgent(session).set_role_user_and_group_associations(role, user_ids=user_ids, group_ids=[]) + GalaxyRBACAgent(session).set_role_user_and_group_associations(role, user_ids=user_ids) # verify no change assert len(role.users) == 0 @@ -765,7 +763,7 @@ def test_invalid_group(self, session, make_role, make_group): # try to set associations with pytest.raises(RequestParameterInvalidException): - GalaxyRBACAgent(session).set_role_user_and_group_associations(role, user_ids=[], group_ids=group_ids) + GalaxyRBACAgent(session).set_role_user_and_group_associations(role, group_ids=group_ids) # verify no change assert len(role.groups) == 0 @@ -907,7 +905,7 @@ def test_delete_default_user_permissions_and_default_history_permissions( assert have_same_elements(history3.default_permissions, [dhp3]) # now update role users - GalaxyRBACAgent(session).set_role_user_and_group_associations(role, user_ids=user_ids, group_ids=[]) + GalaxyRBACAgent(session).set_role_user_and_group_associations(role, user_ids=user_ids) # verify user role associations verify_role_associations(role, new_users_to_add, [])