From fe04f69e891078dd3e6eabd2171796c20ff08114 Mon Sep 17 00:00:00 2001 From: AlanCoding Date: Tue, 3 Apr 2018 07:50:49 -0400 Subject: [PATCH] update tests for org members seeing teams --- awx/main/tests/functional/api/test_organization_counts.py | 4 ++-- awx/main/tests/functional/test_projects.py | 6 +++--- awx/main/tests/functional/test_rbac_api.py | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/awx/main/tests/functional/api/test_organization_counts.py b/awx/main/tests/functional/api/test_organization_counts.py index 9c4f536b09..67bbb81858 100644 --- a/awx/main/tests/functional/api/test_organization_counts.py +++ b/awx/main/tests/functional/api/test_organization_counts.py @@ -92,7 +92,7 @@ def test_org_counts_detail_member(resourced_organization, user, get): 'job_templates': 0, 'projects': 0, 'inventories': 0, - 'teams': 0 + 'teams': 5 } @@ -123,7 +123,7 @@ def test_org_counts_list_member(resourced_organization, user, get): 'job_templates': 0, 'projects': 0, 'inventories': 0, - 'teams': 0 + 'teams': 5 } diff --git a/awx/main/tests/functional/test_projects.py b/awx/main/tests/functional/test_projects.py index 55cc484006..dab22a4d45 100644 --- a/awx/main/tests/functional/test_projects.py +++ b/awx/main/tests/functional/test_projects.py @@ -176,9 +176,9 @@ def test_team_project_list(get, team_project_list): @pytest.mark.django_db -def test_team_project_list_fail1(get, team_project_list): - objects = team_project_list - res = get(reverse('api:team_projects_list', kwargs={'pk':objects.teams.team2.pk,}), objects.users.alice) +def test_team_project_list_fail1(get, team, rando): + # user not in organization not allowed to see team-based views + res = get(reverse('api:team_projects_list', kwargs={'pk':team.pk,}), rando) assert res.status_code == 403 diff --git a/awx/main/tests/functional/test_rbac_api.py b/awx/main/tests/functional/test_rbac_api.py index a390b4c54f..a67474a9bb 100644 --- a/awx/main/tests/functional/test_rbac_api.py +++ b/awx/main/tests/functional/test_rbac_api.py @@ -58,9 +58,9 @@ def test_get_roles_list_user(organization, inventory, team, get, user): assert organization.member_role.id in role_hash assert this_user.admin_role.id in role_hash assert custom_role.id in role_hash + assert team.member_role.id in role_hash assert inventory.admin_role.id not in role_hash - assert team.member_role.id not in role_hash @pytest.mark.django_db @@ -151,7 +151,7 @@ def test_user_view_other_user_roles(organization, inventory, team, get, alice, b assert custom_role.id not in role_hash # doesn't show up in the user roles list, not an explicit grant assert Role.singleton(ROLE_SINGLETON_SYSTEM_ADMINISTRATOR).id not in role_hash assert inventory.admin_role.id not in role_hash - assert team.member_role.id not in role_hash # alice can't see this + assert team.member_role.id in role_hash # alice can see team in her org # again but this time alice is part of the team, and should be able to see the team role team.member_role.members.add(alice)