Initial pop-up for new function.

This commit is contained in:
Alex
2017-02-23 08:21:33 +00:00
committed by Alex Ellis
parent edc2c4b29e
commit 98c9ef67f4
9 changed files with 105 additions and 33 deletions

View File

@ -0,0 +1,34 @@
package inttests
import (
"net/http"
"testing"
)
func TestCreate_ValidJson(t *testing.T) {
reqBody := `{}`
_, code, err := fireRequest("http://localhost:8080/system/functions", http.MethodPost, reqBody)
if err != nil {
t.Log(err)
t.Fail()
}
if code != http.StatusOK {
t.Errorf("Got HTTP code: %d, want %d\n", code, http.StatusBadRequest)
}
}
func TestCreateBadFunctionNotJson(t *testing.T) {
reqBody := `not json`
_, code, err := fireRequest("http://localhost:8080/system/functions", http.MethodPost, reqBody)
if err != nil {
t.Log(err)
t.Fail()
}
if code != http.StatusBadRequest {
t.Errorf("Got HTTP code: %d, want %d\n", code, http.StatusBadRequest)
}
}