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,50 @@
package handlers_test
import (
"net/http"
"otaupdate/handlers"
"otaupdate/services"
"testing"
"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"
"github.com/fiskerinc/cloud-services/pkg/utils/elptr"
)
func TestUpdateManifestAdd(t *testing.T) {
mock := mo.MockUpdateManifests{}
services.GetDB().SetUpdateManifests(&mock)
tests := []mo.DBHttpTest{
{
Name: "Valid data",
Request: th.MakeTestRequest(http.MethodPost, "http://example.com/manifest", common.CreateUpdateManifest{
Name: "package_name",
Version: "100",
Description: "description",
ReleaseNotes: "http://releasenotes.com",
Type: "standard",
RollbackEnabled: true,
Active: elptr.ElPtr(true),
Country: "US",
PowerTrain: "MD23",
Restraint: "None",
Model: "Ocean",
Trim: "Sport",
Year: 2022,
BodyType: "truck",
}),
ExpectedStatus: http.StatusOK,
ExpectedResponse: `{"id":1,"name":"package_name","version":"100","description":"description","release_notes":"http://releasenotes.com","rollback":true,"type":"standard","active":true,"country":"US","powertrain":"MD23","restraint":"None","model":"Ocean","trim":"Sport","year":2022,"body_type":"truck"}`,
},
{
Name: "No data",
Request: th.MakeTestRequest(http.MethodPost, "http://example.com/manifest", nil),
ExpectedStatus: http.StatusBadRequest,
ExpectedResponse: `{"message":"Name required","error":"Bad Request"}`,
},
}
mo.RunDBTests(t, tests, handlers.HandleUpdateManifestAdd, &mock)
}