mirror of
https://github.com/ZwareBear/awx.git
synced 2026-04-21 07:21:49 -05:00
Merge pull request #5946 from AlanCoding/work_success_except
Handle error of missing jobs in success callback
This commit is contained in:
@@ -2,10 +2,12 @@ from contextlib import contextmanager
|
||||
|
||||
import pytest
|
||||
import yaml
|
||||
import mock
|
||||
|
||||
from awx.main.models import (
|
||||
UnifiedJob,
|
||||
Notification,
|
||||
ProjectUpdate
|
||||
)
|
||||
|
||||
from awx.main import tasks
|
||||
@@ -31,6 +33,13 @@ def test_send_notifications_job_id(mocker):
|
||||
assert UnifiedJob.objects.get.called_with(id=1)
|
||||
|
||||
|
||||
def test_work_success_callback_missing_job():
|
||||
task_data = {'type': 'project_update', 'id': 9999}
|
||||
with mock.patch('django.db.models.query.QuerySet.get') as get_mock:
|
||||
get_mock.side_effect = ProjectUpdate.DoesNotExist()
|
||||
assert tasks.handle_work_success(None, task_data) is None
|
||||
|
||||
|
||||
def test_send_notifications_list(mocker):
|
||||
patches = list()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user