Skip to content

Commit

Permalink
Tidy (#421)
Browse files Browse the repository at this point in the history
* use public runners

* swagger generate because someone forgot to

* Fix geo fence test

* fix various tests

* fix couple more tests

* use same integration id, fix some more tests, report problem

* remove calls to registrar for device defintions kafka topic

* more tests passing yay

* all tests passing

---------

Co-authored-by: James Reategui <JamesReate@users.noreply.github.com>
  • Loading branch information
KevinJoiner and JamesReate authored Dec 11, 2024
1 parent 5ee3745 commit dedcd12
Show file tree
Hide file tree
Showing 18 changed files with 118 additions and 244 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/buildpushdev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
build_test:
# The type of runner that the job will run on
name: buildpushdev
runs-on: [self-hosted, linux]
runs-on: [ubuntu-latest]
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/buildpushtagged.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
build_test:
# The type of runner that the job will run on
name: buildpush
runs-on: [self-hosted, linux]
runs-on: [ubuntu-latest]
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
golangci:
runs-on: self-hosted
runs-on: ubuntu-latest

name: lint
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:

jobs:
tests:
runs-on: [self-hosted, linux]
runs-on: [ubuntu-latest]

steps:
- name: Install Go
Expand Down
1 change: 1 addition & 0 deletions docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -3098,6 +3098,7 @@ const docTemplate = `{
"type": "string"
},
"deviceDefinitionId": {
"description": "deprecated",
"type": "string"
}
}
Expand Down
1 change: 1 addition & 0 deletions docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -3090,6 +3090,7 @@
"type": "string"
},
"deviceDefinitionId": {
"description": "deprecated",
"type": "string"
}
}
Expand Down
1 change: 1 addition & 0 deletions docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,7 @@ definitions:
description: DefinitionID new slug id
type: string
deviceDefinitionId:
description: deprecated
type: string
type: object
internal_controllers.RegisterUserDeviceResponse:
Expand Down
16 changes: 8 additions & 8 deletions internal/controllers/device_data_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func TestUserDevicesController_QueryDeviceErrorCodes(t *testing.T) {
ErrorCodes: []string{"P0017", "P0016"},
}

autoPiInteg := test.BuildIntegrationGRPC(constants.AutoPiVendor, 10, 0)
autoPiInteg := test.BuildIntegrationGRPC(ksuid.New().String(), constants.AutoPiVendor, 10, 0)
dd := test.BuildDeviceDefinitionGRPC(ksuid.New().String(), "Toyota", "Camry", 2023, autoPiInteg)
ud := test.SetupCreateUserDevice(t, testUserID, dd[0].DeviceDefinitionId, nil, "", pdb)

Expand Down Expand Up @@ -187,7 +187,7 @@ func TestUserDevicesController_ShouldErrorOnTooManyErrorCodes(t *testing.T) {
ErrorCodes: erCodes,
}

autoPiInteg := test.BuildIntegrationGRPC(constants.AutoPiVendor, 10, 0)
autoPiInteg := test.BuildIntegrationGRPC(ksuid.New().String(), constants.AutoPiVendor, 10, 0)
dd := test.BuildDeviceDefinitionGRPC(ksuid.New().String(), "Toyota", "Camry", 2023, autoPiInteg)
ud := test.SetupCreateUserDevice(t, testUserID, dd[0].DeviceDefinitionId, nil, "", pdb)

Expand Down Expand Up @@ -257,7 +257,7 @@ func TestUserDevicesController_ShouldErrorInvalidErrorCodes(t *testing.T) {
ErrorCodes: []string{"P0010:30", "P33333339"},
}

autoPiInteg := test.BuildIntegrationGRPC(constants.AutoPiVendor, 10, 0)
autoPiInteg := test.BuildIntegrationGRPC(ksuid.New().String(), constants.AutoPiVendor, 10, 0)
dd := test.BuildDeviceDefinitionGRPC(ksuid.New().String(), "Toyota", "Camry", 2023, autoPiInteg)
ud := test.SetupCreateUserDevice(t, testUserID, dd[0].Id, nil, "", pdb)

Expand Down Expand Up @@ -327,7 +327,7 @@ func TestUserDevicesController_ShouldErrorOnEmptyErrorCodes(t *testing.T) {
ErrorCodes: []string{},
}

autoPiInteg := test.BuildIntegrationGRPC(constants.AutoPiVendor, 10, 0)
autoPiInteg := test.BuildIntegrationGRPC(ksuid.New().String(), constants.AutoPiVendor, 10, 0)
dd := test.BuildDeviceDefinitionGRPC(ksuid.New().String(), "Toyota", "Camry", 2023, autoPiInteg)
ud := test.SetupCreateUserDevice(t, testUserID, dd[0].Id, nil, "", pdb)

Expand Down Expand Up @@ -397,7 +397,7 @@ func TestUserDevicesController_ShouldStoreErrorCodeResponse(t *testing.T) {
ErrorCodes: erCodeReq,
}

autoPiInteg := test.BuildIntegrationGRPC(constants.AutoPiVendor, 10, 0)
autoPiInteg := test.BuildIntegrationGRPC(ksuid.New().String(), constants.AutoPiVendor, 10, 0)
dd := test.BuildDeviceDefinitionGRPC(ksuid.New().String(), "Toyota", "Camry", 2023, autoPiInteg)
ud := test.SetupCreateUserDevice(t, testUserID, dd[0].Id, nil, "", pdb)

Expand Down Expand Up @@ -479,7 +479,7 @@ func TestUserDevicesController_GetUserDevicesErrorCodeQueries(t *testing.T) {

t.Run("GET - all saved error code response for current user devices", func(t *testing.T) {

autoPiInteg := test.BuildIntegrationGRPC(constants.AutoPiVendor, 10, 0)
autoPiInteg := test.BuildIntegrationGRPC(ksuid.New().String(), constants.AutoPiVendor, 10, 0)
dd := test.BuildDeviceDefinitionGRPC(ksuid.New().String(), "Toyota", "Camry", 2023, autoPiInteg)
ud := test.SetupCreateUserDevice(t, testUserID, dd[0].DeviceDefinitionId, nil, "", pdb)

Expand Down Expand Up @@ -554,7 +554,7 @@ func TestUserDevicesController_ClearUserDeviceErrorCodeQuery(t *testing.T) {
app.Post("/user/devices/:userDeviceID/error-codes/clear", test.AuthInjectorTestHandler(testUserID), c.ClearUserDeviceErrorCodeQuery)

t.Run("POST - clear last saved error code response for current user devices", func(t *testing.T) {
autoPiInteg := test.BuildIntegrationGRPC(constants.AutoPiVendor, 10, 0)
autoPiInteg := test.BuildIntegrationGRPC(ksuid.New().String(), constants.AutoPiVendor, 10, 0)
dd := test.BuildDeviceDefinitionGRPC(ksuid.New().String(), "Toyota", "Camry", 2023, autoPiInteg)
ud := test.SetupCreateUserDevice(t, testUserID, dd[0].DeviceDefinitionId, nil, "", pdb)

Expand Down Expand Up @@ -641,7 +641,7 @@ func TestUserDevicesController_ErrorOnAllErrorCodesCleared(t *testing.T) {
app.Post("/user/devices/:userDeviceID/error-codes/clear", test.AuthInjectorTestHandler(testUserID), c.ClearUserDeviceErrorCodeQuery)

t.Run("POST - clear last saved error code response for current user devices", func(t *testing.T) {
autoPiInteg := test.BuildIntegrationGRPC(constants.AutoPiVendor, 10, 0)
autoPiInteg := test.BuildIntegrationGRPC(ksuid.New().String(), constants.AutoPiVendor, 10, 0)
dd := test.BuildDeviceDefinitionGRPC(ksuid.New().String(), "Toyota", "Camry", 2023, autoPiInteg)
ud := test.SetupCreateUserDevice(t, testUserID, dd[0].DeviceDefinitionId, nil, "", pdb)

Expand Down
2 changes: 1 addition & 1 deletion internal/controllers/geofences_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ func (g *GeofencesController) GetAll(c *fiber.Ctx) error {
for _, udtg := range item.R.UserDeviceToGeofences {
var deviceDef *ddgrpc.GetDeviceDefinitionItemResponse
for _, dd := range dds {
if dd.DeviceDefinitionId == udtg.R.UserDevice.DeviceDefinitionID {
if dd.Id == udtg.R.UserDevice.DefinitionID {
deviceDef = dd
}
}
Expand Down
4 changes: 2 additions & 2 deletions internal/controllers/geofences_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,8 @@ func (s *GeofencesControllerTestSuite) TestPutGeofence() {
app.Put("/user/geofences/:geofenceID", test.AuthInjectorTestHandler(injectedUserID), c.Update)

dd := test.BuildDeviceDefinitionGRPC(ksuid.New().String(), "Ford", "escaped", 2020, nil)
s.deviceDefSvc.EXPECT().GetDeviceDefinitionBySlug(gomock.Any(), []string{dd[0].DeviceDefinitionId}).Return(dd, nil)
ud := test.SetupCreateUserDevice(s.T(), injectedUserID, dd[0].DeviceDefinitionId, nil, "", s.pdb)
s.deviceDefSvc.EXPECT().GetDeviceDefinitionBySlug(gomock.Any(), dd[0].Id).Return(dd[0], nil)
ud := test.SetupCreateUserDevice(s.T(), injectedUserID, dd[0].Id, nil, "", s.pdb)
ud.TokenID = types.NewNullDecimal(decimal.New(1, 0))
_, err := ud.Update(s.ctx, s.pdb.DBS().Writer, boil.Infer())
s.Require().NoError(err)
Expand Down
62 changes: 28 additions & 34 deletions internal/controllers/user_devices_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ func TestUserDevicesControllerTestSuite(t *testing.T) {
/* Actual Tests */
func (s *UserDevicesControllerTestSuite) TestPostUserDeviceFromSmartcar() {
// arrange DB
integration := test.BuildIntegrationGRPC(constants.AutoPiVendor, 10, 0)
integration := test.BuildIntegrationGRPC(autoPiIntegrationID, constants.AutoPiVendor, 10, 0)
dd := test.BuildDeviceDefinitionGRPC(ksuid.New().String(), "Ford", "F150", 2020, integration)
// act request
vinny := "4T3R6RFVXMU023395"
Expand All @@ -169,15 +169,13 @@ func (s *UserDevicesControllerTestSuite) TestPostUserDeviceFromSmartcar() {

s.deviceDefSvc.EXPECT().DecodeVIN(gomock.Any(), vinny, "", 0, reg.CountryCode).Times(1).Return(&ddgrpc.DecodeVinResponse{
DeviceMakeId: dd[0].Make.Id,
DefinitionId: "ford_f150_2020",
DefinitionId: dd[0].Id,
DeviceStyleId: "",
Year: dd[0].Year,
}, nil)
s.deviceDefIntSvc.EXPECT().CreateDeviceDefinitionIntegration(gomock.Any(), "22N2xaPOq2WW2gAHBHd0Ikn4Zob", dd[0].DeviceDefinitionId, "Americas").Times(1).
Return(nil, nil)

s.redisClient.EXPECT().Set(gomock.Any(), buildSmartcarTokenKey(vinny, testUserID), gomock.Any(), time.Hour*2).Return(nil)
//s.deviceDefSvc.EXPECT().GetDeviceDefinitionBySlug(gomock.Any(), dd[0].DeviceDefinitionId).Times(1).Return(dd[0], nil)
s.userDeviceSvc.EXPECT().CreateUserDevice(gomock.Any(), dd[0].DeviceDefinitionId, "", "USA", testUserID, &vinny, nil, false).
s.userDeviceSvc.EXPECT().CreateUserDevice(gomock.Any(), dd[0].Id, "", "USA", testUserID, &vinny, nil, false).
Return(&models.UserDevice{
ID: ksuid.New().String(),
UserID: testUserID,
Expand Down Expand Up @@ -210,7 +208,7 @@ func (s *UserDevicesControllerTestSuite) TestPostUserDeviceFromSmartcar() {

func (s *UserDevicesControllerTestSuite) TestPostUserDeviceFromSmartcar_Fail_Decode() {
// arrange DB
_ = test.BuildIntegrationGRPC(constants.AutoPiVendor, 10, 0)
_ = test.BuildIntegrationGRPC(autoPiIntegrationID, constants.AutoPiVendor, 10, 0)
// act request
const vinny = "4T3R6RFVXMU023395"
reg := RegisterUserDeviceSmartcar{Code: "XX", RedirectURI: "https://mobile-app", CountryCode: "USA"}
Expand Down Expand Up @@ -241,7 +239,7 @@ func (s *UserDevicesControllerTestSuite) TestPostUserDeviceFromSmartcar_Fail_Dec

func (s *UserDevicesControllerTestSuite) TestPostUserDeviceFromSmartcar_SameUser_DuplicateVIN() {
// arrange DB
integration := test.BuildIntegrationGRPC(constants.AutoPiVendor, 10, 0)
integration := test.BuildIntegrationGRPC(autoPiIntegrationID, constants.AutoPiVendor, 10, 0)
dd := test.BuildDeviceDefinitionGRPC(ksuid.New().String(), "Ford", "F150", 2020, integration)

// act request
Expand Down Expand Up @@ -274,7 +272,7 @@ func (s *UserDevicesControllerTestSuite) TestPostUserDeviceFromSmartcar_SameUser

func (s *UserDevicesControllerTestSuite) TestPostUserDeviceFromSmartcar_Fail_DuplicateVIN() {
// arrange DB
integration := test.BuildIntegrationGRPC(constants.AutoPiVendor, 10, 0)
integration := test.BuildIntegrationGRPC(autoPiIntegrationID, constants.AutoPiVendor, 10, 0)
dd := test.BuildDeviceDefinitionGRPC(ksuid.New().String(), "Ford", "F150", 2020, integration)

// act request
Expand Down Expand Up @@ -305,7 +303,7 @@ func (s *UserDevicesControllerTestSuite) TestPostUserDeviceFromSmartcar_Fail_Dup

func (s *UserDevicesControllerTestSuite) TestPostUserDeviceFromVIN() {
// arrange DB
integration := test.BuildIntegrationGRPC(constants.AutoPiVendor, 10, 0)
integration := test.BuildIntegrationGRPC(autoPiIntegrationID, constants.AutoPiVendor, 10, 0)
dd := test.BuildDeviceDefinitionGRPC(ksuid.New().String(), "Ford", "F150", 2020, integration)
// act request
const deviceStyleID = "24GE7Mlc4c9o4j5P4mcD1Fzinx1"
Expand All @@ -316,15 +314,14 @@ func (s *UserDevicesControllerTestSuite) TestPostUserDeviceFromVIN() {

s.deviceDefSvc.EXPECT().DecodeVIN(gomock.Any(), vinny, "", 0, reg.CountryCode).Times(1).Return(&ddgrpc.DecodeVinResponse{
DeviceMakeId: dd[0].Make.Id,
DefinitionId: "ford_f150_2020",
DefinitionId: dd[0].Id,
DeviceStyleId: deviceStyleID,
Year: dd[0].Year,
}, nil)

apInteg := test.BuildIntegrationGRPC(constants.AutoPiVendor, 10, 10)
apInteg := test.BuildIntegrationGRPC(autoPiIntegrationID, constants.AutoPiVendor, 10, 10)
s.deviceDefIntSvc.EXPECT().GetAutoPiIntegration(gomock.Any()).Times(1).Return(apInteg, nil)
s.deviceDefIntSvc.EXPECT().CreateDeviceDefinitionIntegration(gomock.Any(), apInteg.Id, dd[0].DeviceDefinitionId, "Americas")
s.userDeviceSvc.EXPECT().CreateUserDevice(gomock.Any(), dd[0].DeviceDefinitionId, deviceStyleID, "USA", s.testUserID, &vinny, &canProtocol, false).Times(1).
s.userDeviceSvc.EXPECT().CreateUserDevice(gomock.Any(), dd[0].Id, deviceStyleID, "USA", s.testUserID, &vinny, &canProtocol, false).Times(1).
Return(&models.UserDevice{
ID: ksuid.New().String(),
UserID: s.testUserID,
Expand Down Expand Up @@ -366,7 +363,7 @@ func (s *UserDevicesControllerTestSuite) TestPostUserDeviceFromVIN() {
}

func (s *UserDevicesControllerTestSuite) TestPostUserDeviceFromVIN_FailDecode() {
integration := test.BuildIntegrationGRPC(constants.AutoPiVendor, 10, 0)
integration := test.BuildIntegrationGRPC(autoPiIntegrationID, constants.AutoPiVendor, 10, 0)
_ = test.BuildDeviceDefinitionGRPC(ksuid.New().String(), "Ford", "F150", 2020, integration)

vinny := "4T3R6RFVXMU023395"
Expand All @@ -379,7 +376,7 @@ func (s *UserDevicesControllerTestSuite) TestPostUserDeviceFromVIN_FailDecode()
s.deviceDefSvc.EXPECT().DecodeVIN(gomock.Any(), vinny, "", 0, reg.CountryCode).Times(1).
Return(nil, grpcErr)

apInteg := test.BuildIntegrationGRPC(constants.AutoPiVendor, 10, 10)
apInteg := test.BuildIntegrationGRPC(autoPiIntegrationID, constants.AutoPiVendor, 10, 10)
s.deviceDefIntSvc.EXPECT().GetAutoPiIntegration(gomock.Any()).Times(1).Return(apInteg, nil)

request := test.BuildRequest("POST", "/user/devices/fromvin", string(j))
Expand All @@ -394,7 +391,7 @@ func (s *UserDevicesControllerTestSuite) TestPostUserDeviceFromVIN_FailDecode()

func (s *UserDevicesControllerTestSuite) TestPostUserDeviceFromVIN_SameUser_DuplicateVIN() {
// arrange DB
integration := test.BuildIntegrationGRPC(constants.AutoPiVendor, 10, 0)
integration := test.BuildIntegrationGRPC(autoPiIntegrationID, constants.AutoPiVendor, 10, 0)
dd := test.BuildDeviceDefinitionGRPC(ksuid.New().String(), "Ford", "F150", 2020, integration)
// act request
const vinny = "4T3R6RFVXMU023395"
Expand All @@ -405,11 +402,8 @@ func (s *UserDevicesControllerTestSuite) TestPostUserDeviceFromVIN_SameUser_Dupl
// if the vin already exists for this user, do not expect decode request

s.deviceDefSvc.EXPECT().GetDeviceDefinitionBySlug(gomock.Any(), dd[0].Id).Times(1).Return(dd[0], nil)
apInteg := test.BuildIntegrationGRPC(constants.AutoPiVendor, 10, 10)
apInteg := test.BuildIntegrationGRPC(autoPiIntegrationID, constants.AutoPiVendor, 10, 10)
s.deviceDefIntSvc.EXPECT().GetAutoPiIntegration(gomock.Any()).Times(1).Return(apInteg, nil)
// we always call this just in case
s.deviceDefIntSvc.EXPECT().CreateDeviceDefinitionIntegration(gomock.Any(), apInteg.Id, dd[0].DeviceDefinitionId, "Americas").
Times(1)

request := test.BuildRequest("POST", "/user/devices/fromvin", string(j))
response, responseError := s.app.Test(request, 10000)
Expand Down Expand Up @@ -442,7 +436,7 @@ func (s *UserDevicesControllerTestSuite) TestPostUserDeviceFromVIN_SameUser_Dupl

func (s *UserDevicesControllerTestSuite) TestPostWithExistingDefinitionID() {
// arrange DB
integration := test.BuildIntegrationGRPC(constants.AutoPiVendor, 10, 0)
integration := test.BuildIntegrationGRPC(autoPiIntegrationID, constants.AutoPiVendor, 10, 0)
dd := test.BuildDeviceDefinitionGRPC(ksuid.New().String(), "Ford", "F150", 2020, integration)
// act request
reg := RegisterUserDevice{
Expand Down Expand Up @@ -481,16 +475,16 @@ func (s *UserDevicesControllerTestSuite) TestPostWithExistingDefinitionID() {

func (s *UserDevicesControllerTestSuite) TestPostWithExistingDeviceDefinitionID() {
// arrange DB
integration := test.BuildIntegrationGRPC(constants.AutoPiVendor, 10, 0)
integration := test.BuildIntegrationGRPC(autoPiIntegrationID, constants.AutoPiVendor, 10, 0)
dd := test.BuildDeviceDefinitionGRPC(ksuid.New().String(), "Ford", "F150", 2020, integration)
// act request
reg := RegisterUserDevice{
DeviceDefinitionID: &dd[0].DeviceDefinitionId,
CountryCode: "USA",
DefinitionID: dd[0].Id,
CountryCode: "USA",
}
j, _ := json.Marshal(reg)

s.userDeviceSvc.EXPECT().CreateUserDevice(gomock.Any(), dd[0].DeviceDefinitionId, "", "USA", s.testUserID, nil, nil, false).Times(1).
s.userDeviceSvc.EXPECT().CreateUserDevice(gomock.Any(), dd[0].Id, "", "USA", s.testUserID, nil, nil, false).Times(1).
Return(&models.UserDevice{
ID: ksuid.New().String(),
UserID: testUserID,
Expand Down Expand Up @@ -534,7 +528,7 @@ func (s *UserDevicesControllerTestSuite) TestPostWithoutDefinitionID_BadRequest(
require.NoError(s.T(), err)

errorMessage := gjson.Get(string(body), "message")
if assert.Equal(s.T(), "deviceDefinitionId: cannot be blank.", errorMessage.String()) == false {
if assert.Equal(s.T(), "definitionId is required", errorMessage.String()) == false {
fmt.Println(string(body))
}
}
Expand All @@ -554,8 +548,8 @@ func (s *UserDevicesControllerTestSuite) TestPostInvalidDefinitionID() {
s.userDeviceSvc.EXPECT().CreateUserDevice(gomock.Any(), invalidDD, "", "USA", s.testUserID, nil, nil, false).
Return(nil, nil, grpcErr)
reg := RegisterUserDevice{
DeviceDefinitionID: &invalidDD,
CountryCode: "USA",
CountryCode: "USA",
DefinitionID: invalidDD,
}
j, _ := json.Marshal(reg)

Expand All @@ -581,7 +575,7 @@ func (s *UserDevicesControllerTestSuite) TestGetMyUserDevices() {
deviceID2 = "device2"
)

integration := test.BuildIntegrationGRPC(constants.AutoPiVendor, 10, 0)
integration := test.BuildIntegrationGRPC(autoPiIntegrationID, constants.AutoPiVendor, 10, 0)
dd := test.BuildDeviceDefinitionGRPC(ksuid.New().String(), "Ford", "F150", 2020, integration)
ud := test.SetupCreateUserDevice(s.T(), s.testUserID, dd[0].Id, nil, "", s.pdb)
_ = test.SetupCreateAftermarketDevice(s.T(), testUserID, nil, unitID, func(s string) *string { return &s }(deviceID), s.pdb)
Expand Down Expand Up @@ -625,7 +619,7 @@ func (s *UserDevicesControllerTestSuite) TestGetMyUserDevicesNoDuplicates() {
)
s.controller.Settings.Environment = "dev"

integration := test.BuildIntegrationGRPC(constants.AutoPiVendor, 10, 0)
integration := test.BuildIntegrationGRPC(autoPiIntegrationID, constants.AutoPiVendor, 10, 0)
dd := test.BuildDeviceDefinitionGRPC(ksuid.New().String(), "Ford", "F150", 2020, integration)
ud := test.SetupCreateUserDeviceWithDeviceID(s.T(), userID, deviceID, dd[0].Id, nil, "", s.pdb)
_ = test.SetupCreateAftermarketDevice(s.T(), userID, nil, unitID, func(s string) *string { return &s }(deviceID), s.pdb)
Expand Down Expand Up @@ -658,7 +652,7 @@ func (s *UserDevicesControllerTestSuite) TestGetMyUserDevicesNoDuplicates() {
}

func (s *UserDevicesControllerTestSuite) TestPatchVIN() {
integration := test.BuildIntegrationGRPC(constants.AutoPiVendor, 10, 4)
integration := test.BuildIntegrationGRPC(autoPiIntegrationID, constants.AutoPiVendor, 10, 4)
dd := test.BuildDeviceDefinitionGRPC(ksuid.New().String(), "Ford", "Escape", 2020, integration)

const powertrainType = "powertrain_type"
Expand Down Expand Up @@ -736,7 +730,7 @@ func (s *UserDevicesControllerTestSuite) TestVINValidate() {
}

func (s *UserDevicesControllerTestSuite) TestPostRefreshSmartCar() {
smartCarInt := test.BuildIntegrationGRPC(constants.SmartCarVendor, 10, 0)
smartCarInt := test.BuildIntegrationGRPC(smartCarIntegrationID, constants.SmartCarVendor, 10, 0)
dd := test.BuildDeviceDefinitionGRPC(ksuid.New().String(), "Ford", "Escape", 2020, smartCarInt)
ud := test.SetupCreateUserDevice(s.T(), s.testUserID, dd[0].DeviceDefinitionId, nil, "", s.pdb)
s.deviceDefSvc.EXPECT().GetIntegrationByVendor(gomock.Any(), constants.SmartCarVendor).Return(smartCarInt, nil)
Expand Down Expand Up @@ -786,7 +780,7 @@ func (s *UserDevicesControllerTestSuite) TestPostRefreshSmartCar() {
}

func (s *UserDevicesControllerTestSuite) TestPostRefreshSmartCarRateLimited() {
integration := test.BuildIntegrationGRPC(constants.SmartCarVendor, 10, 0)
integration := test.BuildIntegrationGRPC(smartCarIntegrationID, constants.SmartCarVendor, 10, 0)
dd := test.BuildDeviceDefinitionGRPC(ksuid.New().String(), "Ford", "Mache", 2022, integration)
ud := test.SetupCreateUserDevice(s.T(), s.testUserID, dd[0].DeviceDefinitionId, nil, "", s.pdb)
s.deviceDefSvc.EXPECT().GetIntegrationByVendor(gomock.Any(), constants.SmartCarVendor).Return(integration, nil)
Expand Down
Loading

0 comments on commit dedcd12

Please sign in to comment.