Adding functionality to get & delete incoming webhooks (#5648)

Этот коммит содержится в:
Poornima
2017-03-12 04:10:56 +05:30
коммит произвёл enahum
родитель 11f1859de1
Коммит 482a0fb5fc
8 изменённых файлов: 269 добавлений и 0 удалений

31
api4/context_test.go Обычный файл
Просмотреть файл

@@ -0,0 +1,31 @@
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")
}
})
}