Add depot, attendant, jetfire, optimus, ota services with kustomize overlays
This commit is contained in:
38
services/ota_update_go/handlers/carupdate_delete_test.go
Normal file
38
services/ota_update_go/handlers/carupdate_delete_test.go
Normal file
@@ -0,0 +1,38 @@
|
||||
package handlers_test
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
"otaupdate/handlers"
|
||||
"otaupdate/services"
|
||||
|
||||
"github.com/fiskerinc/cloud-services/pkg/db/queries/mocks"
|
||||
th "github.com/fiskerinc/cloud-services/pkg/testhelper"
|
||||
)
|
||||
|
||||
func TestCarUpdateDelete(t *testing.T) {
|
||||
services.GetDB().SetCarUpdates(&mocks.MockCarUpdates{})
|
||||
tests := []th.BasicHttpTest{
|
||||
{
|
||||
Name: "No id",
|
||||
Request: th.MakeTestRequest(http.MethodGet, "http://example.com/carupdates", nil),
|
||||
ExpectedStatus: http.StatusBadRequest,
|
||||
ExpectedResponse: `{"message":"id required","error":"Bad Request"}`,
|
||||
},
|
||||
{
|
||||
Name: "Zero id",
|
||||
Request: th.MakeTestRequest(http.MethodGet, "http://example.com/carupdates?id=0", nil),
|
||||
ExpectedStatus: http.StatusBadRequest,
|
||||
ExpectedResponse: `{"message":"id required","error":"Bad Request"}`,
|
||||
},
|
||||
{
|
||||
Name: "Good id",
|
||||
Request: th.MakeTestRequest(http.MethodGet, "http://example.com/carupdates?id=1", nil),
|
||||
ExpectedStatus: http.StatusOK,
|
||||
ExpectedResponse: `{"message":"Deleted"}`,
|
||||
},
|
||||
}
|
||||
|
||||
th.RunBasicHttpTests(t, tests, handlers.HandleCarUpdateDelete)
|
||||
}
|
||||
Reference in New Issue
Block a user