Add depot, attendant, jetfire, optimus, ota services with kustomize overlays
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
package handlers_test
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"otaupdate/handlers"
|
||||
"otaupdate/services"
|
||||
"testing"
|
||||
|
||||
mo "github.com/fiskerinc/cloud-services/pkg/db/queries/mocks"
|
||||
th "github.com/fiskerinc/cloud-services/pkg/testhelper"
|
||||
)
|
||||
|
||||
func TestHandleUpdateManifestSUMSUpdate(t *testing.T) {
|
||||
mock := mo.MockUpdateManifests{}
|
||||
services.GetDB().SetUpdateManifests(&mock)
|
||||
|
||||
tests := []mo.DBHttpTest{
|
||||
{
|
||||
Name: "Bad data",
|
||||
Request: th.MakeTestRequest(http.MethodDelete, "/manifests/123/sums", handlers.UpdateManifestVersion{
|
||||
ID: 123,
|
||||
Version: "x",
|
||||
}),
|
||||
ExpectedStatus: http.StatusBadRequest,
|
||||
ExpectedResponse: `{"message":"Version sums_version ","error":"Bad Request"}`,
|
||||
},
|
||||
{
|
||||
Name: "Good params",
|
||||
Request: th.MakeTestRequest(http.MethodDelete, "/manifests/123/sums", handlers.UpdateManifestVersion{
|
||||
ID: 123,
|
||||
Version: "5236.12.50.67",
|
||||
}),
|
||||
ExpectedStatus: http.StatusOK,
|
||||
ExpectedResponse: `{"version":"5236.12.50.67"}`,
|
||||
},
|
||||
}
|
||||
|
||||
mo.RunParamHttpTests(t, tests, handlers.HandleUpdateManifestSUMSUpdate, "/manifests/:id/sums", &mock)
|
||||
}
|
||||
Reference in New Issue
Block a user