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,57 @@
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"
)
func TestUpdateManifestArchive(t *testing.T) {
mock := mo.MockUpdateManifests{}
services.GetDB().SetUpdateManifests(&mock)
tests := []mo.DBHttpTest{
{
Name: "Valid data - remove active",
Request: th.MakeTestRequest(
http.MethodPut,
"http://example.com/manifests/archive",
common.UpdateManifestArchiveRequest{
IDs: []int64{1, 2, 3},
},
),
ExpectedStatus: http.StatusOK,
ExpectedResponse: `{"message":"Archived 3 update manifests"}`,
},
{
Name: "Valid data - make active",
Request: th.MakeTestRequest(
http.MethodPut,
"http://example.com/manifests/archive",
common.UpdateManifestArchiveRequest{
IDs: []int64{1, 2, 3},
Active: true,
},
),
ExpectedStatus: http.StatusOK,
ExpectedResponse: `{"message":"Activated 3 update manifests"}`,
},
{
Name: "No data",
Request: th.MakeTestRequest(
http.MethodPost,
"http://example.com/manifests/archive",
nil,
),
ExpectedStatus: http.StatusBadRequest,
ExpectedResponse: `{"message":"IDs required","error":"Bad Request"}`,
},
}
mo.RunDBTests(t, tests, handlers.HandleUpdateManifestsArchive, &mock)
}