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,47 @@
package handlers_test
import (
"net/http"
"otaupdate/handlers"
"otaupdate/services"
"testing"
"github.com/fiskerinc/cloud-services/pkg/redis/tester"
th "github.com/fiskerinc/cloud-services/pkg/testhelper"
)
func TestHandleVehiclesLocations(t *testing.T) {
conn := tester.NewRedisMock()
conn.GetObjectRawResults = map[string][]byte{
"1F15K3R45N1234567": []byte(`{"altitude":5,"longitude":10,"latitude":15}`),
}
services.SetRedisClientPool(tester.NewMockClientPool(conn))
tests := []th.BasicHttpTest{
{
Name: "Good request",
Request: th.MakeTestRequest(http.MethodGet, "http://example.com/carslocations", nil),
ExpectedStatus: http.StatusOK,
ExpectedResponse: `{"data":[{"altitude":5,"longitude":10,"latitude":15,"heading":0,"vin":"1F15K3R45N1234567"}],"total":1}`,
},
}
th.RunBasicHttpTests(t, tests, handlers.HandleVehiclesLocations)
}
func TestHandleVehiclesLocationsEmpty(t *testing.T) {
conn := tester.NewRedisMock()
conn.GetObjectRawResults = map[string][]byte{}
services.SetRedisClientPool(tester.NewMockClientPool(conn))
tests := []th.BasicHttpTest{
{
Name: "Good request",
Request: th.MakeTestRequest(http.MethodGet, "http://example.com/carslocations", nil),
ExpectedStatus: http.StatusOK,
ExpectedResponse: `{"data":[],"total":0}`,
},
}
th.RunBasicHttpTests(t, tests, handlers.HandleVehiclesLocations)
}