faas/gateway/tests/integration/deletefunction_test.go

35 lines
764 B
Go

package inttests
import (
"net/http"
"testing"
)
func TestDelete_EmptyFunctionGivenFails(t *testing.T) {
reqBody := `{"functionName":""}`
_, code, err := fireRequest("http://localhost:8080/system/functions", http.MethodDelete, 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)
}
}
func TestDelete_NonExistingFunctionGives404(t *testing.T) {
reqBody := `{"functionName":"does_not_exist"}`
_, code, err := fireRequest("http://localhost:8080/system/functions", http.MethodDelete, reqBody)
if err != nil {
t.Log(err)
t.Fail()
}
if code != http.StatusNotFound {
t.Errorf("Got HTTP code: %d, want %d\n", code, http.StatusNotFound)
}
}