mirror of
https://github.com/ansible/awx.git
synced 2026-05-14 21:07:39 -02:30
more gracefully account for undefined stdout
see: https://github.com/ansible/tower/issues/1215 related: https://github.com/ansible/tower/pull/1192#issuecomment-377982131
This commit is contained in:
@@ -13,6 +13,7 @@ import fcntl
|
||||
import mock
|
||||
import pytest
|
||||
import yaml
|
||||
|
||||
from django.conf import settings
|
||||
|
||||
|
||||
@@ -295,6 +296,15 @@ class TestJobExecution:
|
||||
|
||||
class TestGenericRun(TestJobExecution):
|
||||
|
||||
def test_generic_failure(self):
|
||||
self.task.build_private_data_files = mock.Mock(side_effect=IOError())
|
||||
with pytest.raises(Exception):
|
||||
self.task.run(self.pk)
|
||||
update_model_call = self.task.update_model.call_args[1]
|
||||
assert 'IOError' in update_model_call['result_traceback']
|
||||
assert update_model_call['status'] == 'error'
|
||||
assert update_model_call['emitted_events'] == 0
|
||||
|
||||
def test_cancel_flag(self):
|
||||
self.instance.cancel_flag = True
|
||||
with pytest.raises(Exception):
|
||||
|
||||
Reference in New Issue
Block a user