block system auditors from attaching notification templates

This commit is contained in:
AlanCoding
2017-02-17 15:55:05 -05:00
parent 71c6fc2fa1
commit 6d961d92c9
2 changed files with 18 additions and 1 deletions

View File

@@ -2,7 +2,8 @@ import pytest
from awx.main.access import (
NotificationTemplateAccess,
NotificationAccess
NotificationAccess,
JobTemplateAccess
)
@@ -119,6 +120,15 @@ def test_notification_access_system_admin(notification, admin):
assert access.can_delete(notification)
@pytest.mark.django_db
def test_system_auditor_JT_attach(system_auditor, job_template, notification_template):
job_template.admin_role.members.add(system_auditor)
access = JobTemplateAccess(system_auditor)
assert not access.can_attach(
job_template, notification_template, 'notification_templates_success',
{'id': notification_template.id})
@pytest.mark.django_db
def test_notification_access_org_admin(notification, org_admin):
access = NotificationAccess(org_admin)