log.info("Executing request to url %s for vnf alarm %s with status %s", action.url,
alarm.alarm_id, status)
try:
- requests.post(url=action.url, json=json.dumps(payload))
+ requests.post(url=action.url, json=json.dumps(payload), timeout=10)
except RequestException as e:
log.info("Error connecting to url %s", action.url)
log.debug("RequestException %s", e)
service = AlarmingService(self.config)
self.loop.run_until_complete(service.handle_alarm('test_id', 'alarm', {}))
- requests_post.assert_called_once_with(json='{}', url='http://alarm-url/')
+ requests_post.assert_called_once_with(json='{}', url='http://alarm-url/', timeout=10)
requests_post.reset_mock()
self.loop.run_until_complete(service.handle_alarm('test_id', 'ok', {}))
- requests_post.assert_called_once_with(json='{}', url='http://ok-url/')
+ requests_post.assert_called_once_with(json='{}', url='http://ok-url/', timeout=10)
requests_post.reset_mock()
self.loop.run_until_complete(service.handle_alarm('test_id', 'insufficient-data', {}))
- requests_post.assert_called_once_with(json='{}', url='http://insufficient-data-url/')
+ requests_post.assert_called_once_with(json='{}', url='http://insufficient-data-url/', timeout=10)
@mock.patch.object(VnfAlarmRepository, 'get')
@mock.patch('requests.post')