0001-workflows-write-connection-error-info-to-associated-.patch
tests/test_workflows.py | ||
---|---|---|
1793 | 1793 |
item.record_errors = True |
1794 | 1794 |
item.action_on_network_errors = ':pass' |
1795 | 1795 |
item.perform(formdata) |
1796 |
assert not formdata.workflow_data |
|
1797 | ||
1798 |
# connection error, with varname |
|
1799 |
item = WebserviceCallStatusItem() |
|
1800 |
item.url = 'http://remote.example.net/connection-error' |
|
1801 |
item.varname = 'plop' |
|
1802 |
item.record_errors = True |
|
1803 |
item.action_on_network_errors = ':pass' |
|
1804 |
item.perform(formdata) |
|
1796 | 1805 |
assert formdata.evolution[-1].parts[-1].summary == 'ConnectionError: error\n' |
1806 |
assert formdata.workflow_data['plop_connection_error'] == 'error' |
|
1797 | 1807 | |
1798 | 1808 |
def test_webservice_call_store_in_backoffice_filefield(http_requests, pub): |
1799 | 1809 |
wf = Workflow(name='wscall to backoffice file field') |
wcs/wf/wscall.py | ||
---|---|---|
274 | 274 |
# misconfigured action |
275 | 275 |
return |
276 | 276 | |
277 |
workflow_data = {} |
|
278 |
if self.varname: |
|
279 |
workflow_data['%s_time' % self.varname] = datetime.datetime.now().isoformat() |
|
280 | ||
277 | 281 |
try: |
278 | 282 |
response, status, data = call_webservice( |
279 | 283 |
url=self.url, |
... | ... | |
285 | 289 |
formdata=formdata) |
286 | 290 |
except ConnectionError as e: |
287 | 291 |
status = 0 |
292 |
if self.varname: |
|
293 |
workflow_data['%s_connection_error' % self.varname] = str(e) |
|
294 |
formdata.update_workflow_data(workflow_data) |
|
295 |
formdata.store() |
|
288 | 296 |
self.action_on_error(self.action_on_network_errors, formdata, |
289 | 297 |
exc_info=sys.exc_info()) |
290 | 298 |
return |
... | ... | |
307 | 315 |
app_error_code = d['err'] |
308 | 316 | |
309 | 317 |
if self.varname: |
310 |
workflow_data = {
|
|
318 |
workflow_data.update({
|
|
311 | 319 |
'%s_status' % self.varname: status, |
312 |
'%s_time' % self.varname: datetime.datetime.now().isoformat(), |
|
313 | 320 |
'%s_app_error_code' % self.varname: app_error_code, |
314 |
} |
|
321 |
})
|
|
315 | 322 |
if app_error_code_header: |
316 | 323 |
workflow_data['%s_app_error_header' % self.varname] = app_error_code_header |
317 | 324 |
if status in (204, 205): |
318 |
- |