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,41 @@
package handlers_test
import (
"net/http"
"testing"
"otaupdate/handlers"
"otaupdate/services"
mo "github.com/fiskerinc/cloud-services/pkg/db/queries/mocks"
th "github.com/fiskerinc/cloud-services/pkg/testhelper"
)
func TestIssueGet(t *testing.T) {
mock := mo.MockIssue{}
services.GetDB().SetIssues(&mock)
tests := []th.BasicHttpTest{
{
Name: "Invalid Issue ID",
Request: th.MakeTestRequest(http.MethodGet, "http://example.com/issues/x", nil),
ExpectedStatus: http.StatusNotFound,
ExpectedResponse: `{"message":"invalid id","error":"Not Found"}`,
},
{
Name: "Zero Issue ID",
Request: th.MakeTestRequest(http.MethodGet, "http://example.com/issues/0", nil),
ExpectedStatus: http.StatusBadRequest,
ExpectedResponse: `{"message":"id cannot be less than 0","error":"Bad Request"}`,
},
{
Name: "Good Issue Id",
Request: th.MakeTestRequest(http.MethodGet, "http://example.com/issues/1", nil),
ExpectedStatus: http.StatusOK,
ExpectedResponse: `{"data":{"id":1,"vin":"","title":"","description":"","timestamp":"0001-01-01T00:00:00Z","images":[{"id":1,"image":"","issue_id":1}]}}`,
},
}
th.RunParamHttpTests(t, tests, handlers.HandleIssueGet, "/issues/:id")
}