Initial cloud-services repo - gateway service + pkg modules

This commit is contained in:
Chris Rai
2026-01-30 23:14:52 -05:00
commit fbb820d7b3
1037 changed files with 171318 additions and 0 deletions

52
pkg/userconsent/mock.go Normal file
View File

@@ -0,0 +1,52 @@
package userconsent
import (
"net/http"
"net/http/httptest"
"fiskerinc.com/modules/common"
"fiskerinc.com/modules/validator"
"fiskerinc.com/modules/utils"
)
type UserConsentServiceMock struct{}
func (ucsm *UserConsentServiceMock) UserConsentByVehicleNumber(vin string) (*http.Response, error) {
w := httptest.NewRecorder()
userConsentDataArray := []common.UserConsentDataResponse{
{
VehicleIdNum: vin,
ConsentName: validator.NAV_LOCATION_DATA,
ConsentAction: "ACCEPTED",
},
{
VehicleIdNum: vin,
ConsentName: validator.CONNECTED_CAR_FEATURE,
ConsentAction: "ACCEPTED",
},
}
if vin == "9F15K3R45N1234567" {
userConsentDataArray[0].ConsentAction = "DECLINED"
}
utils.RespJSON(w, http.StatusOK, userConsentDataArray)
return w.Result(), nil
}
func (ucsm *UserConsentServiceMock) UserConsent(ucd common.UserConsentDataRequest) (*http.Response, error) {
w := httptest.NewRecorder()
userConsentDataResponse := common.UserConsentDataResponse{
VehicleIdNum: ucd.VehicleIdNum,
ConsentName: ucd.ConsentName,
ConsentAction: ucd.ConsentAction,
}
utils.RespJSON(w, http.StatusCreated, userConsentDataResponse)
return w.Result(), nil
}