From 28a119ca962bb7c3d72024538091acfdb241cf77 Mon Sep 17 00:00:00 2001 From: Rebeccah Date: Fri, 27 Sep 2019 15:43:52 -0400 Subject: [PATCH] re-worked unit test into 3 seperate unit tests, one for orphans, one for group members, and one for multi-group members --- awx/main/tests/functional/test_rbac_user.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/awx/main/tests/functional/test_rbac_user.py b/awx/main/tests/functional/test_rbac_user.py index b5ad2c04b7..ca3d268b18 100644 --- a/awx/main/tests/functional/test_rbac_user.py +++ b/awx/main/tests/functional/test_rbac_user.py @@ -153,6 +153,21 @@ def test_org_admin_edit_sys_auditor(org_admin, alice, organization): @pytest.mark.django_db -def test_org_admin_can_delete_user(org_admin, alice): +def test_org_admin_can_delete_orphan(org_admin, alice): access = UserAccess(org_admin) - assert access.can_delete(alice) \ No newline at end of file + assert access.can_delete(alice) + + +@pytest.mark.django_db +def test_org_admin_can_delete_group_member(org_admin, org_member): + access = UserAccess(org_admin) + assert access.can_delete(org_member) + + +@pytest.mark.django_db +def test_org_admin_cannot_delete_member_attached_to_other_group(org_admin, org_member): + other_org = Organization.objects.create(name="other-org", description="other-org-desc") + access = UserAccess(org_admin) + other_org.member_role.members.add(org_member) + assert not access.can_delete(org_member) + \ No newline at end of file