Correct Sentry webhook payload parsing (#304)
This commit is contained in:
parent
0836ac391e
commit
adba941103
2 changed files with 2 additions and 1 deletions
webhooks/sentry
|
@ -7,7 +7,7 @@ class SentryWebhook(WebhookBase):
|
|||
|
||||
def incoming(self, query_string, payload):
|
||||
|
||||
if payload.get('event')['sentry.interfaces.Http']['env'] == 'prod':
|
||||
if payload.get('event')['sentry.interfaces.Http']['env']['ENV'] == 'prod':
|
||||
environment = 'Production'
|
||||
else:
|
||||
environment = 'Development'
|
||||
|
|
|
@ -410,6 +410,7 @@ class SentryWebhookTestCase(unittest.TestCase):
|
|||
data = json.loads(response.data.decode('utf-8'))
|
||||
self.assertEqual(data['alert']['resource'], 'raven.scripts.runner in main')
|
||||
self.assertEqual(data['alert']['event'], '0476467adf8f499ea795a48fcc4bf290')
|
||||
self.assertEqual(data['alert']['environment'], 'Production')
|
||||
self.assertEqual(data['alert']['value'], 'error')
|
||||
self.assertEqual(data['alert']['text'], 'This is an example Python exception https://sentry.io/alertaio/alerta5/issues/541485531/')
|
||||
self.assertEqual(sorted(data['alert']['tags']), ['browser=Chrome 28.0', 'device=Other', 'level=error', 'os=Windows 8', 'sentry:user=id:1', 'url=http://example.com/foo'])
|
||||
|
|
Loading…
Add table
Reference in a new issue