mirror of
https://github.com/openfaas/faas.git
synced 2025-06-19 12:36:40 +00:00
Vendoring with Glide and delete function handler
This commit is contained in:
34
gateway/tests/integration/deletefunction_test.go
Normal file
34
gateway/tests/integration/deletefunction_test.go
Normal file
@ -0,0 +1,34 @@
|
||||
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)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user