diff options
author | Corey Hulen <corey@hulen.com> | 2017-06-02 09:08:04 -0700 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2017-06-02 12:08:04 -0400 |
commit | 6a54f3c4890135ea925365e59628afbb58ff6f87 (patch) | |
tree | 6e489ad8f03c9499d4c31c2b8aca40820666b316 /api/webhook_test.go | |
parent | 1c9ec861fd39ea3bb3361813c3a44483da3e3f56 (diff) | |
download | chat-6a54f3c4890135ea925365e59628afbb58ff6f87.tar.gz chat-6a54f3c4890135ea925365e59628afbb58ff6f87.tar.bz2 chat-6a54f3c4890135ea925365e59628afbb58ff6f87.zip |
PLT-6581 breakup webhooks greater than 4K into multiple posts (#6530)
Diffstat (limited to 'api/webhook_test.go')
-rw-r--r-- | api/webhook_test.go | 100 |
1 files changed, 50 insertions, 50 deletions
diff --git a/api/webhook_test.go b/api/webhook_test.go index 5a0e44630..93d596bb1 100644 --- a/api/webhook_test.go +++ b/api/webhook_test.go @@ -1005,37 +1005,37 @@ func TestIncomingWebhooks(t *testing.T) { } attachmentPayload := `{ - "text": "this is a test", - "attachments": [ - { - "fallback": "Required plain-text summary of the attachment.", + "text": "this is a test", + "attachments": [ + { + "fallback": "Required plain-text summary of the attachment.", - "color": "#36a64f", + "color": "#36a64f", - "pretext": "Optional text that appears above the attachment block", + "pretext": "Optional text that appears above the attachment block", - "author_name": "Bobby Tables", - "author_link": "http://flickr.com/bobby/", - "author_icon": "http://flickr.com/icons/bobby.jpg", + "author_name": "Bobby Tables", + "author_link": "http://flickr.com/bobby/", + "author_icon": "http://flickr.com/icons/bobby.jpg", - "title": "Slack API Documentation", - "title_link": "https://api.slack.com/", + "title": "Slack API Documentation", + "title_link": "https://api.slack.com/", - "text": "Optional text that appears within the attachment", + "text": "Optional text that appears within the attachment", - "fields": [ - { - "title": "Priority", - "value": "High", - "short": false - } - ], + "fields": [ + { + "title": "Priority", + "value": "High", + "short": false + } + ], - "image_url": "http://my-website.com/path/to/image.jpg", - "thumb_url": "http://example.com/path/to/thumb.png" - } - ] - }` + "image_url": "http://my-website.com/path/to/image.jpg", + "thumb_url": "http://example.com/path/to/thumb.png" + } + ] + }` if _, err := Client.DoPost(url, attachmentPayload, "application/json"); err != nil { t.Fatal(err) @@ -1050,42 +1050,42 @@ func TestIncomingWebhooks(t *testing.T) { tooLongText += "a" } - if _, err := Client.DoPost(url, "{\"text\":\""+tooLongText+"\"}", "application/json"); err == nil || err.StatusCode != http.StatusBadRequest { - t.Fatal("should have failed - text too long") + if _, err := Client.DoPost(url, "{\"text\":\""+tooLongText+"\"}", "application/json"); err != nil { + t.Fatal(err) } attachmentPayload = `{ - "text": "this is a test", - "attachments": [ - { - "fallback": "Required plain-text summary of the attachment.", + "text": "this is a test", + "attachments": [ + { + "fallback": "Required plain-text summary of the attachment.", - "color": "#36a64f", + "color": "#36a64f", - "pretext": "Optional text that appears above the attachment block", + "pretext": "Optional text that appears above the attachment block", - "author_name": "Bobby Tables", - "author_link": "http://flickr.com/bobby/", - "author_icon": "http://flickr.com/icons/bobby.jpg", + "author_name": "Bobby Tables", + "author_link": "http://flickr.com/bobby/", + "author_icon": "http://flickr.com/icons/bobby.jpg", - "title": "Slack API Documentation", - "title_link": "https://api.slack.com/", + "title": "Slack API Documentation", + "title_link": "https://api.slack.com/", - "text": "` + tooLongText + `", + "text": "` + tooLongText + `", - "fields": [ - { - "title": "Priority", - "value": "High", - "short": false - } - ], + "fields": [ + { + "title": "Priority", + "value": "High", + "short": false + } + ], - "image_url": "http://my-website.com/path/to/image.jpg", - "thumb_url": "http://example.com/path/to/thumb.png" - } - ] - }` + "image_url": "http://my-website.com/path/to/image.jpg", + "thumb_url": "http://example.com/path/to/thumb.png" + } + ] + }` if _, err := Client.DoPost(url, attachmentPayload, "application/json"); err == nil || err.StatusCode != http.StatusBadRequest { t.Fatal("should have failed with bad request - attachment too long") |