From 36286bcda2f778148ec098b37ca544ba8773b41c Mon Sep 17 00:00:00 2001 From: AlanCoding Date: Tue, 12 Jul 2016 11:14:29 -0400 Subject: [PATCH] notifier rbac test made consistent with others --- awx/main/tests/functional/conftest.py | 2 +- .../functional/test_rbac_notifications.py | 20 +++++++++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/awx/main/tests/functional/conftest.py b/awx/main/tests/functional/conftest.py index fdc3d3d95e..f970adc2e7 100644 --- a/awx/main/tests/functional/conftest.py +++ b/awx/main/tests/functional/conftest.py @@ -202,7 +202,7 @@ def notification(notification_template): status='successful', notifications_sent=1, notification_type='email', - recipients='admin@admin.com', + recipients='admin@redhat.com', subject='email subject') @pytest.fixture diff --git a/awx/main/tests/functional/test_rbac_notifications.py b/awx/main/tests/functional/test_rbac_notifications.py index 1af0d06818..a9a5e7c5f9 100644 --- a/awx/main/tests/functional/test_rbac_notifications.py +++ b/awx/main/tests/functional/test_rbac_notifications.py @@ -91,13 +91,29 @@ def test_notificaiton_template_orphan_access_org_admin(notification_template, or assert not access.can_change(notification_template, {'organization': organization.id}) @pytest.mark.django_db -def test_notification_access_org_admin(notification, org_admin): +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) - assert access.get_queryset().count() == 1 assert access.can_read(notification) + assert not access.can_delete(notification)