summaryrefslogtreecommitdiffstats
path: root/model/command_response_test.go
diff options
context:
space:
mode:
authorChris <ccbrown112@gmail.com>2017-08-16 07:17:57 -0500
committerJoram Wilander <jwawilander@gmail.com>2017-08-16 08:17:57 -0400
commitb122381e87577ddfc12b792a3de9121ea830d50e (patch)
tree1487a6a97aa0a928db230b207463e721e56858c9 /model/command_response_test.go
parent5cd45c939406e5af84b0d9a6967683b77100303c (diff)
downloadchat-b122381e87577ddfc12b792a3de9121ea830d50e.tar.gz
chat-b122381e87577ddfc12b792a3de9121ea830d50e.tar.bz2
chat-b122381e87577ddfc12b792a3de9121ea830d50e.zip
PLT-1649: add response_url support for custom slash commands (#6739)
* add response_url support for custom slash commands * pr suggestions * pr update / suggestion * test fix
Diffstat (limited to 'model/command_response_test.go')
-rw-r--r--model/command_response_test.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/model/command_response_test.go b/model/command_response_test.go
index df478ff2c..19be796b8 100644
--- a/model/command_response_test.go
+++ b/model/command_response_test.go
@@ -18,6 +18,30 @@ func TestCommandResponseJson(t *testing.T) {
}
}
+func TestCommandResponseFromHTTPBody(t *testing.T) {
+ for _, test := range []struct {
+ ContentType string
+ Body string
+ ExpectedText string
+ }{
+ {"", "foo", "foo"},
+ {"text/plain", "foo", "foo"},
+ {"application/json", `{"text": "foo"}`, "foo"},
+ } {
+ response := CommandResponseFromHTTPBody(test.ContentType, strings.NewReader(test.Body))
+ if response.Text != test.ExpectedText {
+ t.Fatal()
+ }
+ }
+}
+
+func TestCommandResponseFromPlainText(t *testing.T) {
+ response := CommandResponseFromPlainText("foo")
+ if response.Text != "foo" {
+ t.Fatal("text should be foo")
+ }
+}
+
func TestCommandResponseFromJson(t *testing.T) {
json := `{
"response_type": "ephemeral",