mirror of
https://github.com/ansible/awx.git
synced 2026-01-12 10:30:03 -03:30
verify notification errors included in NT list view
This commit is contained in:
parent
e4eb03259b
commit
a6f3817488
@ -123,6 +123,29 @@ def test_disallow_delete_when_notifications_pending(delete, user, notification_t
|
||||
assert response.status_code == 405
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_notification_template_list_includes_notification_errors(get, user, notification_template):
|
||||
Notification.objects.create(notification_template=notification_template, status='failed', error='failed to send')
|
||||
Notification.objects.create(notification_template=notification_template, status='pending')
|
||||
Notification.objects.create(notification_template=notification_template, status='successful')
|
||||
url = reverse('api:notification_template_list')
|
||||
u = user('superuser', True)
|
||||
response = get(url, user=u)
|
||||
|
||||
assert response.status_code == 200
|
||||
notifications = response.data['results'][0]['summary_fields']['recent_notifications']
|
||||
assert len(notifications) == 3
|
||||
statuses = [n['status'] for n in notifications]
|
||||
assert set(statuses) == set(['failed', 'pending', 'successful'])
|
||||
for n in notifications:
|
||||
if n['status'] == 'successful':
|
||||
assert n['error'] == ''
|
||||
elif n['status'] == 'pending':
|
||||
assert n['error'] == ''
|
||||
elif n['status'] == 'failed':
|
||||
assert n['error'] == 'failed to send'
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_custom_environment_injection(post, user, organization):
|
||||
u = user('admin-poster', True)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user