mirror of
https://github.com/ansible/awx.git
synced 2024-11-02 09:51:09 +03:00
test fixes for new role names
This commit is contained in:
parent
911c92707c
commit
da12da2a05
@ -74,9 +74,9 @@ def test_team_project_list(get, project_factory, team_factory, admin, alice, bob
|
||||
assert get(reverse('api:team_projects_list', args=(team1.pk,)), alice).data['count'] == 2
|
||||
|
||||
# but if she does, then she should only see the shared project
|
||||
team2.auditor_role.members.add(alice)
|
||||
team2.read_role.members.add(alice)
|
||||
assert get(reverse('api:team_projects_list', args=(team2.pk,)), alice).data['count'] == 1
|
||||
team2.auditor_role.members.remove(alice)
|
||||
team2.read_role.members.remove(alice)
|
||||
|
||||
# Test user endpoints first, very similar tests to test_user_project_list
|
||||
# but permissions are being derived from team membership instead.
|
||||
|
@ -42,12 +42,12 @@ def test_inventory_auditor_user(inventory, permissions, user):
|
||||
perm.save()
|
||||
|
||||
assert u not in inventory.admin_role
|
||||
assert u not in inventory.auditor_role
|
||||
assert u not in inventory.read_role
|
||||
|
||||
rbac.migrate_inventory(apps, None)
|
||||
|
||||
assert u not in inventory.admin_role
|
||||
assert u in inventory.auditor_role
|
||||
assert u in inventory.read_role
|
||||
assert inventory.execute_role.members.filter(id=u.id).exists() is False
|
||||
assert inventory.update_role.members.filter(id=u.id).exists() is False
|
||||
|
||||
@ -58,7 +58,7 @@ def test_inventory_updater_user(inventory, permissions, user):
|
||||
perm.save()
|
||||
|
||||
assert u not in inventory.admin_role
|
||||
assert u not in inventory.auditor_role
|
||||
assert u not in inventory.read_role
|
||||
|
||||
rbac.migrate_inventory(apps, None)
|
||||
|
||||
@ -73,7 +73,7 @@ def test_inventory_executor_user(inventory, permissions, user):
|
||||
perm.save()
|
||||
|
||||
assert u not in inventory.admin_role
|
||||
assert u not in inventory.auditor_role
|
||||
assert u not in inventory.read_role
|
||||
|
||||
rbac.migrate_inventory(apps, None)
|
||||
|
||||
@ -98,7 +98,7 @@ def test_inventory_admin_team(inventory, permissions, user, team):
|
||||
|
||||
assert team.member_role.members.count() == 1
|
||||
assert inventory.admin_role.members.filter(id=u.id).exists() is False
|
||||
assert inventory.auditor_role.members.filter(id=u.id).exists() is False
|
||||
assert inventory.read_role.members.filter(id=u.id).exists() is False
|
||||
assert inventory.execute_role.members.filter(id=u.id).exists() is False
|
||||
assert inventory.update_role.members.filter(id=u.id).exists() is False
|
||||
assert u in inventory.read_role
|
||||
@ -113,14 +113,14 @@ def test_inventory_auditor(inventory, permissions, user, team):
|
||||
team.deprecated_users.add(u)
|
||||
|
||||
assert u not in inventory.admin_role
|
||||
assert u not in inventory.auditor_role
|
||||
assert u not in inventory.read_role
|
||||
|
||||
rbac.migrate_team(apps,None)
|
||||
rbac.migrate_inventory(apps, None)
|
||||
|
||||
assert team.member_role.members.count() == 1
|
||||
assert inventory.admin_role.members.filter(id=u.id).exists() is False
|
||||
assert inventory.auditor_role.members.filter(id=u.id).exists() is False
|
||||
assert inventory.read_role.members.filter(id=u.id).exists() is False
|
||||
assert inventory.execute_role.members.filter(id=u.id).exists() is False
|
||||
assert inventory.update_role.members.filter(id=u.id).exists() is False
|
||||
assert u in inventory.read_role
|
||||
@ -134,14 +134,14 @@ def test_inventory_updater(inventory, permissions, user, team):
|
||||
team.deprecated_users.add(u)
|
||||
|
||||
assert u not in inventory.admin_role
|
||||
assert u not in inventory.auditor_role
|
||||
assert u not in inventory.read_role
|
||||
|
||||
rbac.migrate_team(apps,None)
|
||||
rbac.migrate_inventory(apps, None)
|
||||
|
||||
assert team.member_role.members.count() == 1
|
||||
assert inventory.admin_role.members.filter(id=u.id).exists() is False
|
||||
assert inventory.auditor_role.members.filter(id=u.id).exists() is False
|
||||
assert inventory.read_role.members.filter(id=u.id).exists() is False
|
||||
assert inventory.execute_role.members.filter(id=u.id).exists() is False
|
||||
assert inventory.update_role.members.filter(id=u.id).exists() is False
|
||||
assert team.member_role.is_ancestor_of(inventory.update_role)
|
||||
@ -156,14 +156,14 @@ def test_inventory_executor(inventory, permissions, user, team):
|
||||
team.deprecated_users.add(u)
|
||||
|
||||
assert u not in inventory.admin_role
|
||||
assert u not in inventory.auditor_role
|
||||
assert u not in inventory.read_role
|
||||
|
||||
rbac.migrate_team(apps, None)
|
||||
rbac.migrate_inventory(apps, None)
|
||||
|
||||
assert team.member_role.members.count() == 1
|
||||
assert inventory.admin_role.members.filter(id=u.id).exists() is False
|
||||
assert inventory.auditor_role.members.filter(id=u.id).exists() is False
|
||||
assert inventory.read_role.members.filter(id=u.id).exists() is False
|
||||
assert inventory.execute_role.members.filter(id=u.id).exists() is False
|
||||
assert inventory.update_role.members.filter(id=u.id).exists() is False
|
||||
assert team.member_role.is_ancestor_of(inventory.update_role) is False
|
||||
|
@ -72,7 +72,7 @@ def test_team_access_member(organization, team, user):
|
||||
def test_team_accessible_by(team, user, project):
|
||||
u = user('team_member', False)
|
||||
|
||||
team.member_role.children.add(project.member_role)
|
||||
team.member_role.children.add(project.use_role)
|
||||
assert team in project.read_role
|
||||
assert u not in project.read_role
|
||||
|
||||
@ -83,7 +83,7 @@ def test_team_accessible_by(team, user, project):
|
||||
def test_team_accessible_objects(team, user, project):
|
||||
u = user('team_member', False)
|
||||
|
||||
team.member_role.children.add(project.member_role)
|
||||
team.member_role.children.add(project.use_role)
|
||||
assert len(Project.accessible_objects(team, 'read_role')) == 1
|
||||
assert not Project.accessible_objects(u, 'read_role')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user