mirror of
https://github.com/ansible/awx.git
synced 2026-01-15 20:00:43 -03:30
Fix migration tests to use new deprecated fields
This commit is contained in:
parent
49165c4fcd
commit
5b70f29a39
@ -81,7 +81,7 @@ def test_inventory_admin_team(inventory, permissions, user, team):
|
||||
u = user('admin', False)
|
||||
perm = Permission(team=team, inventory=inventory, permission_type='admin')
|
||||
perm.save()
|
||||
team.users.add(u)
|
||||
team.deprecated_users.add(u)
|
||||
|
||||
assert inventory.accessible_by(u, permissions['admin']) is False
|
||||
|
||||
@ -105,7 +105,7 @@ def test_inventory_auditor(inventory, permissions, user, team):
|
||||
u = user('auditor', False)
|
||||
perm = Permission(team=team, inventory=inventory, permission_type='read')
|
||||
perm.save()
|
||||
team.users.add(u)
|
||||
team.deprecated_users.add(u)
|
||||
|
||||
assert inventory.accessible_by(u, permissions['admin']) is False
|
||||
assert inventory.accessible_by(u, permissions['auditor']) is False
|
||||
@ -129,7 +129,7 @@ def test_inventory_updater(inventory, permissions, user, team):
|
||||
u = user('updater', False)
|
||||
perm = Permission(team=team, inventory=inventory, permission_type='write')
|
||||
perm.save()
|
||||
team.users.add(u)
|
||||
team.deprecated_users.add(u)
|
||||
|
||||
assert inventory.accessible_by(u, permissions['admin']) is False
|
||||
assert inventory.accessible_by(u, permissions['auditor']) is False
|
||||
@ -154,7 +154,7 @@ def test_inventory_executor(inventory, permissions, user, team):
|
||||
u = user('executor', False)
|
||||
perm = Permission(team=team, inventory=inventory, permission_type='read', run_ad_hoc_commands=True)
|
||||
perm.save()
|
||||
team.users.add(u)
|
||||
team.deprecated_users.add(u)
|
||||
|
||||
assert inventory.accessible_by(u, permissions['admin']) is False
|
||||
assert inventory.accessible_by(u, permissions['auditor']) is False
|
||||
|
||||
@ -16,7 +16,7 @@ def test_job_template_migration_check(deploy_jobtemplate, check_jobtemplate, use
|
||||
joe = user('joe')
|
||||
|
||||
|
||||
check_jobtemplate.project.organizations.all()[0].users.add(joe)
|
||||
check_jobtemplate.project.organizations.all()[0].deprecated_users.add(joe)
|
||||
|
||||
Permission(user=joe, inventory=check_jobtemplate.inventory, permission_type='read').save()
|
||||
Permission(user=joe, inventory=check_jobtemplate.inventory,
|
||||
@ -45,7 +45,7 @@ def test_job_template_migration_deploy(deploy_jobtemplate, check_jobtemplate, us
|
||||
joe = user('joe')
|
||||
|
||||
|
||||
deploy_jobtemplate.project.organizations.all()[0].users.add(joe)
|
||||
deploy_jobtemplate.project.organizations.all()[0].deprecated_users.add(joe)
|
||||
|
||||
Permission(user=joe, inventory=deploy_jobtemplate.inventory, permission_type='read').save()
|
||||
Permission(user=joe, inventory=deploy_jobtemplate.inventory,
|
||||
@ -73,11 +73,11 @@ def test_job_template_migration_deploy(deploy_jobtemplate, check_jobtemplate, us
|
||||
def test_job_template_team_migration_check(deploy_jobtemplate, check_jobtemplate, organization, team, user):
|
||||
admin = user('admin', is_superuser=True)
|
||||
joe = user('joe')
|
||||
team.users.add(joe)
|
||||
team.deprecated_users.add(joe)
|
||||
team.organization = organization
|
||||
team.save()
|
||||
|
||||
check_jobtemplate.project.organizations.all()[0].users.add(joe)
|
||||
check_jobtemplate.project.organizations.all()[0].deprecated_users.add(joe)
|
||||
|
||||
Permission(team=team, inventory=check_jobtemplate.inventory, permission_type='read').save()
|
||||
Permission(team=team, inventory=check_jobtemplate.inventory,
|
||||
@ -108,11 +108,11 @@ def test_job_template_team_migration_check(deploy_jobtemplate, check_jobtemplate
|
||||
def test_job_template_team_deploy_migration(deploy_jobtemplate, check_jobtemplate, organization, team, user):
|
||||
admin = user('admin', is_superuser=True)
|
||||
joe = user('joe')
|
||||
team.users.add(joe)
|
||||
team.deprecated_users.add(joe)
|
||||
team.organization = organization
|
||||
team.save()
|
||||
|
||||
deploy_jobtemplate.project.organizations.all()[0].users.add(joe)
|
||||
deploy_jobtemplate.project.organizations.all()[0].deprecated_users.add(joe)
|
||||
|
||||
Permission(team=team, inventory=deploy_jobtemplate.inventory, permission_type='read').save()
|
||||
Permission(team=team, inventory=deploy_jobtemplate.inventory,
|
||||
|
||||
@ -12,7 +12,7 @@ from django.apps import apps
|
||||
@pytest.mark.django_db
|
||||
def test_organization_migration_admin(organization, permissions, user):
|
||||
u = user('admin', False)
|
||||
organization.admins.add(u)
|
||||
organization.deprecated_admins.add(u)
|
||||
|
||||
# Undo some automatic work that we're supposed to be testing with our migration
|
||||
organization.admin_role.members.remove(u)
|
||||
@ -26,7 +26,7 @@ def test_organization_migration_admin(organization, permissions, user):
|
||||
@pytest.mark.django_db
|
||||
def test_organization_migration_user(organization, permissions, user):
|
||||
u = user('user', False)
|
||||
organization.users.add(u)
|
||||
organization.deprecated_users.add(u)
|
||||
|
||||
# Undo some automatic work that we're supposed to be testing with our migration
|
||||
organization.member_role.members.remove(u)
|
||||
@ -42,14 +42,14 @@ def test_organization_migration_user(organization, permissions, user):
|
||||
@pytest.mark.django_db
|
||||
def test_organization_access_superuser(cl, organization, user):
|
||||
access = OrganizationAccess(user('admin', True))
|
||||
organization.users.add(user('user', False))
|
||||
organization.deprecated_users.add(user('user', False))
|
||||
|
||||
assert access.can_change(organization, None)
|
||||
assert access.can_delete(organization)
|
||||
|
||||
org = access.get_queryset()[0]
|
||||
assert len(org.admins.all()) == 0
|
||||
assert len(org.users.all()) == 1
|
||||
assert len(org.deprecated_admins.all()) == 0
|
||||
assert len(org.deprecated_users.all()) == 1
|
||||
|
||||
|
||||
@mock.patch.object(BaseAccess, 'check_license', return_value=None)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user