summaryrefslogtreecommitdiffstats
path: root/api4/context_test.go
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2018-05-14 10:24:58 -0400
committerGitHub <noreply@github.com>2018-05-14 10:24:58 -0400
commit47250c6629416b628a19e5571ac89f7b4646418c (patch)
tree0ccfd50e06af7293e0f9e27c2d1c1200efa78a6a /api4/context_test.go
parent7e7c55198719337e7cb39b07c0d5a48c0a6908de (diff)
downloadchat-47250c6629416b628a19e5571ac89f7b4646418c.tar.gz
chat-47250c6629416b628a19e5571ac89f7b4646418c.tar.bz2
chat-47250c6629416b628a19e5571ac89f7b4646418c.zip
Refactor context out of API packages (#8755)
* Refactor context out of API packages * Update function names per feedback * Move webhook handlers to web and fix web tests * Move more webhook tests out of api package * Fix static handler
Diffstat (limited to 'api4/context_test.go')
-rw-r--r--api4/context_test.go31
1 files changed, 0 insertions, 31 deletions
diff --git a/api4/context_test.go b/api4/context_test.go
deleted file mode 100644
index 302b7b24b..000000000
--- a/api4/context_test.go
+++ /dev/null
@@ -1,31 +0,0 @@
-package api4
-
-import (
- "net/http"
- "testing"
-)
-
-func TestRequireHookId(t *testing.T) {
- c := &Context{}
- t.Run("WhenHookIdIsValid", func(t *testing.T) {
- c.Params = &ApiParams{HookId: "abcdefghijklmnopqrstuvwxyz"}
- c.RequireHookId()
-
- if c.Err != nil {
- t.Fatal("Hook Id is Valid. Should not have set error in context")
- }
- })
-
- t.Run("WhenHookIdIsInvalid", func(t *testing.T) {
- c.Params = &ApiParams{HookId: "abc"}
- c.RequireHookId()
-
- if c.Err == nil {
- t.Fatal("Should have set Error in context")
- }
-
- if c.Err.StatusCode != http.StatusBadRequest {
- t.Fatal("Should have set status as 400")
- }
- })
-}