Add depot, attendant, jetfire, optimus, ota services with kustomize overlays

This commit is contained in:
Chris Rai
2026-01-31 15:35:07 -05:00
parent a0ec642ca1
commit 9a5cb2f547
404 changed files with 38817 additions and 16 deletions

View File

@@ -0,0 +1,59 @@
package handlers_test
import (
"net/http"
"testing"
"otaupdate/handlers"
"otaupdate/services"
"github.com/fiskerinc/cloud-services/pkg/db/queries/mocks"
"github.com/fiskerinc/cloud-services/pkg/mongo"
th "github.com/fiskerinc/cloud-services/pkg/testhelper"
)
func TestVehicleDelete(t *testing.T) {
client, err := services.GetMongoClient()
if err != nil {
t.Error(err)
return
}
services.GetDB().SetCars(&mocks.MockCars{})
client.SetVehicles(mongo.NewVehiclesCollection(&mongo.MockCollection{}))
client.SetFleets(mongo.NewFleetsCollection(&mongo.MockCollection{
AggregateObject: []mongo.Fleet{
{
Name: "US-TEST",
Vehicles: []string{
"2HNYD18936H520501",
},
},
},
}))
tests := []th.BasicHttpTest{
{
Name: "Zero id",
Request: th.MakeTestRequest(http.MethodDelete, "http://example.com/vehicle/0", nil),
ExpectedStatus: http.StatusBadRequest,
ExpectedResponse: `{"message":"VIN '0' invalid","error":"Bad Request"}`,
},
{
Name: "Good id",
Request: th.MakeTestRequest(http.MethodDelete, "http://example.com/vehicle/1G1FP87S3GN100062", nil),
ExpectedStatus: http.StatusOK,
ExpectedResponse: `{"message":"Deleted"}`,
},
{
Name: "VIN with fleet",
Request: th.MakeTestRequest(http.MethodDelete, "http://example.com/vehicle/2HNYD18936H520501", nil),
ExpectedStatus: http.StatusOK,
ExpectedResponse: `{"message":"Deleted"}`,
},
}
_ = tests
_ = handlers.HandleVehicleDeleteHoneyPot
//th.RunParamHttpTests(t, tests, handlers.HandleVehicleDelete, "/vehicle/:vin")
}