diff --git a/pkg/notification/httpnotify_test.go b/pkg/notification/httpnotify_test.go index 90d4398..58c9221 100644 --- a/pkg/notification/httpnotify_test.go +++ b/pkg/notification/httpnotify_test.go @@ -1,6 +1,11 @@ package notification -import "testing" +import ( + "io/ioutil" + "net/http" + "net/http/httptest" + "testing" +) func TestNewSimpleHttpNotify(t *testing.T) { n := NewSimpleHttpNotify("test") @@ -8,3 +13,18 @@ func TestNewSimpleHttpNotify(t *testing.T) { t.Fatal("should not be nil") } } + +func TestNotify(t *testing.T) { + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + defer r.Body.Close() + body, _ := ioutil.ReadAll(r.Body) + if string(body) != "test" { + t.Fatal("should be test") + } + })) + + defer ts.Close() + n := NewSimpleHttpNotify(ts.URL) + n.Notify([]byte("test")) + +}