Add depot, attendant, jetfire, optimus, ota services with kustomize overlays
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
package handlers_test
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"otaupdate/handlers"
|
||||
"otaupdate/services"
|
||||
"testing"
|
||||
|
||||
m "github.com/fiskerinc/cloud-services/pkg/common"
|
||||
mo "github.com/fiskerinc/cloud-services/pkg/db/queries/mocks"
|
||||
th "github.com/fiskerinc/cloud-services/pkg/testhelper"
|
||||
)
|
||||
|
||||
func TestHandleFlashpackVersionDelete(t *testing.T) {
|
||||
mock := mo.MockCars{}
|
||||
services.GetDB().SetCars(&mock)
|
||||
|
||||
tests := []mo.DBHttpTest{
|
||||
{
|
||||
Name: "Bad data",
|
||||
Request: th.MakeTestRequest(http.MethodDelete, "http://example.com/flashpack_version", m.CarFlashpackVersionRequest{
|
||||
Flashpack: "41.14",
|
||||
CarModel: "Ocean",
|
||||
CarTrim: "Base",
|
||||
}),
|
||||
ExpectedStatus: http.StatusBadRequest,
|
||||
ExpectedResponse: `{"message":"CarYear required","error":"Bad Request"}`,
|
||||
},
|
||||
{
|
||||
Name: "Valid data",
|
||||
Request: th.MakeTestRequest(http.MethodDelete, "http://example.com/flashpack_version", m.CarFlashpackVersionRequest{
|
||||
Flashpack: "41.14",
|
||||
CarModel: "Ocean",
|
||||
CarTrim: "Base",
|
||||
CarYear: 2023,
|
||||
}),
|
||||
ExpectedStatus: http.StatusOK,
|
||||
ExpectedResponse: `{"message":"Deleted"}`,
|
||||
},
|
||||
}
|
||||
|
||||
mo.RunParamHttpTests(t, tests, handlers.HandleFlashpackVersionDelete, "/flashpack_version", &mock)
|
||||
}
|
||||
Reference in New Issue
Block a user