def test_send_failsafe(self, send_payload): test_uuid = str(uuid.uuid4()) test_host = socket.gethostname() test_data = { 'access_token': _test_access_token, 'data': { 'body': { 'message': { 'body': 'Failsafe from pyrollbar: test message. ' 'Original payload may be found in your server ' 'logs by searching for the UUID.' } }, 'failsafe': True, 'level': 'error', 'custom': { 'orig_host': test_host, 'orig_uuid': test_uuid }, 'environment': rollbar.SETTINGS['environment'], 'internal': True, 'notifier': rollbar.SETTINGS['notifier'] } } rollbar._send_failsafe('test message', test_uuid, test_host) self.assertEqual(send_payload.call_count, 1) self.assertEqual(json.loads(send_payload.call_args[0][0]), test_data)
def test_send_failsafe(self, send_payload): test_uuid = str(uuid.uuid4()) test_host = socket.gethostname() test_data = { 'access_token': _test_access_token, 'data': { 'body': { 'message': { 'body': 'Failsafe from pyrollbar: test message. ' 'Original payload may be found in your server ' 'logs by searching for the UUID.' } }, 'failsafe': True, 'level': 'error', 'custom': { 'orig_host': test_host, 'orig_uuid': test_uuid }, 'environment': rollbar.SETTINGS['environment'], 'internal': True, 'notifier': rollbar.SETTINGS['notifier'] } } rollbar._send_failsafe('test message', test_uuid, test_host) self.assertEqual(send_payload.call_count, 1) self.assertEqual(send_payload.call_args[0][0], test_data)
def test_fail_to_send_failsafe(self, send_payload, mock_log): test_uuid = str(uuid.uuid4()) test_host = socket.gethostname() rollbar._send_failsafe('test message', test_uuid, test_host) self.assertEqual(mock_log.call_count, 1)