From 55bd0cb92dc020a568a4ea1e7b86920893e0e85d Mon Sep 17 00:00:00 2001 From: Allyson-English Date: Tue, 9 Apr 2024 11:08:00 -0600 Subject: [PATCH] vnft test helper --- .../controllers/synthetic_devices_controller_test.go | 12 ++++++------ internal/test/helpers.go | 3 ++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/internal/controllers/synthetic_devices_controller_test.go b/internal/controllers/synthetic_devices_controller_test.go index 6bc9ecba7..585483641 100644 --- a/internal/controllers/synthetic_devices_controller_test.go +++ b/internal/controllers/synthetic_devices_controller_test.go @@ -134,7 +134,7 @@ func (s *SyntheticDevicesControllerTestSuite) TestGetSyntheticDeviceMintingPaylo test.BuildDeviceDefinitionGRPC(ksuid.New().String(), "Ford", "Explorer", 2022, nil) udID := ksuid.New().String() - test.SetupCreateVehicleNFTForMiddleware(s.T(), *addr, mockUserID, udID, s.pdb) + test.SetupCreateVehicleNFTForMiddleware(s.T(), *addr, mockUserID, udID, 57, s.pdb) test.SetupCreateUserDeviceAPIIntegration(s.T(), "", "xddL", udID, integration.Id, s.pdb) request := test.BuildRequest("GET", fmt.Sprintf("/v1/user/devices/%s/integrations/%s/commands/mint", udID, integration.Id), "") @@ -163,7 +163,7 @@ func (s *SyntheticDevicesControllerTestSuite) TestGetSyntheticDeviceMintingPaylo test.BuildDeviceDefinitionGRPC(ksuid.New().String(), "Ford", "Explorer", 2022, nil) udID := ksuid.New().String() - test.SetupCreateVehicleNFTForMiddleware(s.T(), *addr, mockUserID, udID, s.pdb) + test.SetupCreateVehicleNFTForMiddleware(s.T(), *addr, mockUserID, udID, 57, s.pdb) test.SetupCreateUserDeviceAPIIntegration(s.T(), "", "xddL", udID, integration.Id, s.pdb) request := test.BuildRequest("GET", fmt.Sprintf("/v1/user/devices/%s/integrations/%s/commands/mint", udID, integration.Id), "") @@ -190,7 +190,7 @@ func (s *SyntheticDevicesControllerTestSuite) TestGetSyntheticDeviceMintingPaylo test.BuildDeviceDefinitionGRPC(ksuid.New().String(), "Ford", "Explorer", 2022, nil) udID := ksuid.New().String() - test.SetupCreateVehicleNFTForMiddleware(s.T(), *addr, mockUserID, udID, s.pdb) + test.SetupCreateVehicleNFTForMiddleware(s.T(), *addr, mockUserID, udID, 57, s.pdb) test.SetupCreateUserDeviceAPIIntegration(s.T(), "", "xddL", udID, integration.Id, s.pdb) request := test.BuildRequest("GET", fmt.Sprintf("/v1/user/devices/%s/integrations/%s/commands/mint", udID, integration.Id), "") @@ -219,7 +219,7 @@ func (s *SyntheticDevicesControllerTestSuite) TestGetSyntheticDeviceMintingPaylo test.BuildDeviceDefinitionGRPC(ksuid.New().String(), "Ford", "Explorer", 2022, nil) udID := ksuid.New().String() - test.SetupCreateVehicleNFTForMiddleware(s.T(), *addr, mockUserID, udID, s.pdb) + test.SetupCreateVehicleNFTForMiddleware(s.T(), *addr, mockUserID, udID, 57, s.pdb) test.SetupCreateUserDeviceAPIIntegration(s.T(), "", "xddL", udID, integration.Id, s.pdb) request := test.BuildRequest("GET", fmt.Sprintf("/v1/user/devices/%s/integrations/%s/commands/mint", udID, integration.Id), "") @@ -276,7 +276,7 @@ func (s *SyntheticDevicesControllerTestSuite) Test_MintSyntheticDeviceSmartcar() test.BuildDeviceDefinitionGRPC(ksuid.New().String(), "Ford", "Explorer", 2022, nil) udID := ksuid.New().String() - test.SetupCreateVehicleNFTForMiddleware(s.T(), *addr, mockUserID, udID, s.pdb) + test.SetupCreateVehicleNFTForMiddleware(s.T(), *addr, mockUserID, udID, 57, s.pdb) test.SetupCreateUserDeviceAPIIntegration(s.T(), "", "xddL", udID, integration.Id, s.pdb) vehicleSig := common.BytesToHash(common.HexToAddress("20").Bytes()).Bytes() @@ -379,7 +379,7 @@ func (s *SyntheticDevicesControllerTestSuite) TestSignSyntheticDeviceMintingPayl test.BuildDeviceDefinitionGRPC(ksuid.New().String(), "Ford", "Explorer", 2022, nil) udID := ksuid.New().String() - test.SetupCreateVehicleNFTForMiddleware(s.T(), *addr, mockUserID, udID, s.pdb) + test.SetupCreateVehicleNFTForMiddleware(s.T(), *addr, mockUserID, udID, 57, s.pdb) test.SetupCreateUserDeviceAPIIntegration(s.T(), "", "xddL", udID, integration.Id, s.pdb) req := `{ diff --git a/internal/test/helpers.go b/internal/test/helpers.go index 54cdcbaf3..76c420c0e 100644 --- a/internal/test/helpers.go +++ b/internal/test/helpers.go @@ -309,7 +309,7 @@ func SetupCreateVehicleNFT(t *testing.T, userDevice models.UserDevice, tokenID * return &userDevice } -func SetupCreateVehicleNFTForMiddleware(t *testing.T, addr common.Address, userID, userDeviceID string, pdb db.Store) *models.UserDevice { +func SetupCreateVehicleNFTForMiddleware(t *testing.T, addr common.Address, userID, userDeviceID string, tokenID int64, pdb db.Store) *models.UserDevice { mint := models.MetaTransactionRequest{ ID: ksuid.New().String(), } @@ -326,6 +326,7 @@ func SetupCreateVehicleNFTForMiddleware(t *testing.T, addr common.Address, userI MintRequestID: null.StringFrom(mint.ID), OwnerAddress: null.BytesFrom(common.FromHex(addr.String())), VinConfirmed: true, + TokenID: types.NewNullDecimal(new(decimal.Big).SetBigMantScale(big.NewInt(tokenID), 0)), } err = ud.Insert(context.Background(), pdb.DBS().Writer, boil.Infer()) assert.NoError(t, err)