Merge "Ignore bad requests in notification hook"

This commit is contained in:
Jenkins 2016-12-31 18:47:47 +00:00 committed by Gerrit Code Review
commit 5b66484873
2 changed files with 5 additions and 1 deletions

View File

@ -68,6 +68,10 @@ class NotificationHook(hooks.PecanHook):
if state.request.method not in ['POST', 'PUT', 'DELETE']:
return
# Ignore requests that failed
if state.response.status_code >= 400:
return
request = state.request
response = state.response

View File

@ -256,7 +256,7 @@ class TestNotificationHook(base.BaseDbTestCase):
mock_state.request.headers = {'Referer': 'http://localhost/'}
mock_state.request.query_string = ''
mock_state.request.path = '/v1/tasks/1'
mock_state.response.status_code = '200'
mock_state.response.status_code = 200
mock_state.old_entity_values = sot_json
mock_get_original_resource.return_value = smt_json