mirror of
https://github.com/ansible/awx.git
synced 2024-11-02 01:21:21 +03:00
environment specific label test failure fix
This commit is contained in:
parent
6f39995060
commit
15558aac08
@ -1956,7 +1956,7 @@ class LabelAccess(BaseAccess):
|
|||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
if self.user.is_superuser or self.user.is_system_auditor:
|
if self.user.is_superuser or self.user.is_system_auditor:
|
||||||
return self.model.objects.all()
|
return self.model.objects.all()
|
||||||
return self.model.objects.filter(
|
return self.model.objects.all().filter(
|
||||||
organization__in=Organization.accessible_objects(self.user, 'read_role')
|
organization__in=Organization.accessible_objects(self.user, 'read_role')
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -6,8 +6,9 @@ from awx.main.access import (
|
|||||||
|
|
||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
def test_label_get_queryset_user(label, user):
|
def test_label_get_queryset_user(label, user):
|
||||||
access = LabelAccess(user('user', False))
|
u = user('user', False)
|
||||||
label.organization.member_role.members.add(user('user', False))
|
access = LabelAccess(u)
|
||||||
|
label.organization.member_role.members.add(u)
|
||||||
assert access.get_queryset().count() == 1
|
assert access.get_queryset().count() == 1
|
||||||
|
|
||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
|
Loading…
Reference in New Issue
Block a user