Add depot, attendant, jetfire, optimus, ota services with kustomize overlays
This commit is contained in:
47
services/ota_update_go/handlers/vehicles_locations_test.go
Normal file
47
services/ota_update_go/handlers/vehicles_locations_test.go
Normal 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)
|
||||
}
|
||||
Reference in New Issue
Block a user