|
|
@ -147,3 +147,25 @@ class TestTaskResult(unittest.TestCase):
|
|
|
|
tr = TaskResult(mock_host, mock_task, dict(_ansible_no_log=True, secret='DONTSHOWME'))
|
|
|
|
tr = TaskResult(mock_host, mock_task, dict(_ansible_no_log=True, secret='DONTSHOWME'))
|
|
|
|
clean = tr.clean_copy()
|
|
|
|
clean = tr.clean_copy()
|
|
|
|
self.assertTrue('secret' not in clean._result)
|
|
|
|
self.assertTrue('secret' not in clean._result)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_task_result_no_log_preserve(self):
|
|
|
|
|
|
|
|
mock_host = MagicMock()
|
|
|
|
|
|
|
|
mock_task = MagicMock()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# no_log should not remove presrved keys
|
|
|
|
|
|
|
|
tr = TaskResult(
|
|
|
|
|
|
|
|
mock_host,
|
|
|
|
|
|
|
|
mock_task,
|
|
|
|
|
|
|
|
dict(
|
|
|
|
|
|
|
|
_ansible_no_log=True,
|
|
|
|
|
|
|
|
retries=5,
|
|
|
|
|
|
|
|
attempts=5,
|
|
|
|
|
|
|
|
changed=False,
|
|
|
|
|
|
|
|
foo='bar',
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
clean = tr.clean_copy()
|
|
|
|
|
|
|
|
self.assertTrue('retries' in clean._result)
|
|
|
|
|
|
|
|
self.assertTrue('attempts' in clean._result)
|
|
|
|
|
|
|
|
self.assertTrue('changed' in clean._result)
|
|
|
|
|
|
|
|
self.assertTrue('foo' not in clean._result)
|
|
|
|