1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Fixing bug when returned 404 status code considered as invalid (#33530)

In case of workflow delete action, the returned 404 status code
considered as invalid although it's a valid code for not found (deleted)
entity.
Removed verification of the status. Only success should be verified.

Fixes #33524
This commit is contained in:
Evgeny Fedoruk 2017-12-06 16:18:45 +02:00 committed by John R Barker
parent dfd68e4966
commit e73d3dfe20
2 changed files with 5 additions and 1 deletions

View file

@ -294,7 +294,7 @@ class VdirectRunnable(object):
result = self.client.runnable.run(data, self.type, self.name, self.action_name)
result_to_return = {'msg': ''}
if result[rest_client.RESP_STATUS] == 200:
if result[rest_client.RESP_DATA]['status'] == 200 and result[rest_client.RESP_DATA]['success']:
if result[rest_client.RESP_DATA]['success']:
if self.type == WORKFLOW_TEMPLATE_RUNNABLE_TYPE:
result_to_return['msg'] = WORKFLOW_CREATION_SUCCESS
elif self.type == CONFIGURATION_TEMPLATE_RUNNABLE_TYPE:

View file

@ -261,6 +261,10 @@ class TestManager(unittest.TestCase):
res = vdirectRunnable.run()
assert res == MODULE_RESULT
RUN_RESULT[self.module_mock.rest_client.RESP_DATA]['status'] = 404
vdirectRunnable.run()
assert res == MODULE_RESULT
RUN_RESULT[self.module_mock.rest_client.RESP_STATUS] = 400
RUN_RESULT[self.module_mock.rest_client.RESP_REASON] = "Reason"
RUN_RESULT[self.module_mock.rest_client.RESP_STR] = "Details"