Add support for the rollbar occurrence webhook event. (#1692)

This commit is contained in:
François de Metz
2017-09-29 20:49:22 +02:00
committed by Daniel Nelson
parent 7dfdc9304e
commit 945eabc273
5 changed files with 138 additions and 0 deletions

View File

@@ -42,6 +42,29 @@ func TestNewItem(t *testing.T) {
acc.AssertContainsTaggedFields(t, "rollbar_webhooks", fields, tags)
}
func TestOccurrence(t *testing.T) {
var acc testutil.Accumulator
rb := &RollbarWebhook{Path: "/rollbar", acc: &acc}
resp := postWebhooks(rb, OccurrenceJSON())
if resp.Code != http.StatusOK {
t.Errorf("POST occurrence returned HTTP status code %v.\nExpected %v", resp.Code, http.StatusOK)
}
fields := map[string]interface{}{
"id": 402860571,
}
tags := map[string]string{
"event": "occurrence",
"environment": "production",
"project_id": "78234",
"language": "php",
"level": "error",
}
acc.AssertContainsTaggedFields(t, "rollbar_webhooks", fields, tags)
}
func TestDeploy(t *testing.T) {
var acc testutil.Accumulator
rb := &RollbarWebhook{Path: "/rollbar", acc: &acc}