Skip to content

Commit

Permalink
Fix syntax error in last fix, delete tests we do not need
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanCoding committed Jan 2, 2024
1 parent 283d1fa commit 79517b6
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 21 deletions.
2 changes: 1 addition & 1 deletion awx/main/access.py
Original file line number Diff line number Diff line change
Expand Up @@ -2584,7 +2584,7 @@ def can_add(self, data):
return False
if not data:
if settings.ROLE_GATEWAY_SYSTEM_ACTIVATED:
return user.has_roles.filter(permission_partials__codename__in=['execute_jobtemplate', 'update_project', 'update_inventory']).exists()
return self.user.has_roles.filter(permission_partials__codename__in=['execute_jobtemplate', 'update_project', 'update_inventory']).exists()
return Role.objects.filter(role_field__in=['update_role', 'execute_role'], ancestors__in=self.user.roles.all()).exists()

return self.check_related('unified_job_template', UnifiedJobTemplate, data, role_field='execute_role', mandatory=True)
Expand Down
11 changes: 0 additions & 11 deletions awx/main/tests/functional/api/test_role.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,6 @@
from awx.api.versioning import reverse


@pytest.mark.django_db
def test_admin_visible_to_orphaned_users(get, alice):
names = set()

response = get(reverse('api:role_list'), user=alice)
for item in response.data['results']:
names.add(item['name'])
assert 'System Auditor' in names
assert 'System Administrator' in names


@pytest.mark.django_db
@pytest.mark.parametrize('role,code', [('member_role', 400), ('admin_role', 400), ('inventory_admin_role', 204)])
@pytest.mark.parametrize('reversed', [True, False])
Expand Down
9 changes: 0 additions & 9 deletions awx/main/tests/functional/models/test_context_managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,6 @@
from awx.main.tests.functional import immediate_on_commit


@pytest.mark.django_db
def test_rbac_batch_rebuilding(rando, organization):
with batch_role_ancestor_rebuilding():
organization.admin_role.members.add(rando)
inventory = organization.inventories.create(name='test-inventory')
assert rando not in inventory.admin_role
assert rando in inventory.admin_role


@pytest.mark.django_db
def test_disable_activity_stream():
with disable_activity_stream():
Expand Down

0 comments on commit 79517b6

Please sign in to comment.