mirror of
https://github.com/ansible/awx.git
synced 2026-05-16 22:07:36 -02:30
Fix flake8 E302 errors.
This commit is contained in:
@@ -5,33 +5,39 @@ from awx.main.access import (
|
||||
NotificationAccess
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_notification_template_get_queryset_orgmember(notification_template, user):
|
||||
access = NotificationTemplateAccess(user('user', False))
|
||||
notification_template.organization.member_role.members.add(user('user', False))
|
||||
assert access.get_queryset().count() == 0
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_notification_template_get_queryset_nonorgmember(notification_template, user):
|
||||
access = NotificationTemplateAccess(user('user', False))
|
||||
assert access.get_queryset().count() == 0
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_notification_template_get_queryset_su(notification_template, user):
|
||||
access = NotificationTemplateAccess(user('user', True))
|
||||
assert access.get_queryset().count() == 1
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_notification_template_get_queryset_orgadmin(notification_template, user):
|
||||
access = NotificationTemplateAccess(user('admin', False))
|
||||
notification_template.organization.admin_role.members.add(user('admin', False))
|
||||
assert access.get_queryset().count() == 1
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_notification_template_get_queryset_org_auditor(notification_template, org_auditor):
|
||||
access = NotificationTemplateAccess(org_auditor)
|
||||
assert access.get_queryset().count() == 1
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_notification_template_access_superuser(notification_template_factory):
|
||||
nf_objects = notification_template_factory('test-orphaned', organization='test', superusers=['admin'])
|
||||
@@ -50,6 +56,7 @@ def test_notification_template_access_superuser(notification_template_factory):
|
||||
assert access.can_change(nf, None)
|
||||
assert access.can_delete(nf)
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_notification_template_access_admin(organization_factory, notification_template_factory):
|
||||
other_objects = organization_factory('other')
|
||||
@@ -75,6 +82,7 @@ def test_notification_template_access_admin(organization_factory, notification_t
|
||||
assert not access.can_change(nf, None)
|
||||
assert not access.can_delete(nf)
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_notification_template_access_org_user(notification_template, user):
|
||||
u = user('normal', False)
|
||||
@@ -84,34 +92,40 @@ def test_notification_template_access_org_user(notification_template, user):
|
||||
assert not access.can_change(notification_template, None)
|
||||
assert not access.can_delete(notification_template)
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_notificaiton_template_orphan_access_org_admin(notification_template, organization, org_admin):
|
||||
notification_template.organization = None
|
||||
access = NotificationTemplateAccess(org_admin)
|
||||
assert not access.can_change(notification_template, {'organization': organization.id})
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_notification_access_get_queryset_org_admin(notification, org_admin):
|
||||
access = NotificationAccess(org_admin)
|
||||
assert access.get_queryset().count() == 1
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_notification_access_get_queryset_org_auditor(notification, org_auditor):
|
||||
access = NotificationAccess(org_auditor)
|
||||
assert access.get_queryset().count() == 1
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_notification_access_system_admin(notification, admin):
|
||||
access = NotificationAccess(admin)
|
||||
assert access.can_read(notification)
|
||||
assert access.can_delete(notification)
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_notification_access_org_admin(notification, org_admin):
|
||||
access = NotificationAccess(org_admin)
|
||||
assert access.can_read(notification)
|
||||
assert access.can_delete(notification)
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_notification_access_org_auditor(notification, org_auditor):
|
||||
access = NotificationAccess(org_auditor)
|
||||
|
||||
Reference in New Issue
Block a user