fix: shamir mock setup for machine issuance test

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
This commit is contained in:
Lorenz Herzberger 2024-07-03 09:21:12 +02:00
parent 62fe799eca
commit c133a1fd79
No known key found for this signature in database
GPG Key ID: FA5EE906EB55316A
2 changed files with 13 additions and 2 deletions

View File

@ -64,8 +64,8 @@ func Load(t *testing.T, configs ...Config) *Network {
}, nil) }, nil)
shamirMock.EXPECT().IssueMachineNFT(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes().Return(clients.IssueMachineNFTResponse{ shamirMock.EXPECT().IssueMachineNFT(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes().Return(clients.IssueMachineNFTResponse{
HexTX: "0000000000000000000000000000000000000000000000000000000000000000", HexTX: "0000000000000000000000000000000000000000000000000000000000000000",
Contract: "contract", Contract: `{"entity":{"domain":"testnet-assets.rddl.io"}, "issuer_pubkey":"02", "machine_addr":"addr","name":"machine","precicion":8,"version":1}`,
Asset: "7add40beb27df701e02ee85089c5bc0021bc813823fedb5f1dcb5debda7f3da9", Asset: "0000000000000000000000000000000000000000000000000000000000000000",
}, nil) }, nil)
clients.ShamirCoordinatorServiceClient = shamirMock clients.ShamirCoordinatorServiceClient = shamirMock

View File

@ -9,7 +9,10 @@ import (
"testing" "testing"
sdk "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/golang/mock/gomock"
"github.com/planetmint/planetmint-go/clients"
"github.com/planetmint/planetmint-go/testutil/keeper" "github.com/planetmint/planetmint-go/testutil/keeper"
clientmocks "github.com/planetmint/planetmint-go/testutil/mocks"
"github.com/planetmint/planetmint-go/testutil/moduleobject" "github.com/planetmint/planetmint-go/testutil/moduleobject"
"github.com/planetmint/planetmint-go/testutil/sample" "github.com/planetmint/planetmint-go/testutil/sample"
"github.com/planetmint/planetmint-go/util" "github.com/planetmint/planetmint-go/util"
@ -47,7 +50,15 @@ func TestRegisterNFT(t *testing.T) {
} }
func TestMachineNFTIssuance(t *testing.T) { func TestMachineNFTIssuance(t *testing.T) {
ctrl := gomock.NewController(t)
elements.Client = &elementsmocks.MockClient{} elements.Client = &elementsmocks.MockClient{}
shamirMock := clientmocks.NewMockIShamirCoordinatorClient(ctrl)
shamirMock.EXPECT().IssueMachineNFT(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes().Return(clients.IssueMachineNFTResponse{
HexTX: "0000000000000000000000000000000000000000000000000000000000000000",
Contract: `{"entity":{"domain":"testnet-assets.rddl.io"}, "issuer_pubkey":"02", "machine_addr":"addr","name":"machine","precicion":8,"version":1}`,
Asset: "0000000000000000000000000000000000000000000000000000000000000000",
}, nil)
clients.ShamirCoordinatorServiceClient = shamirMock
util.RegisterAssetServiceHTTPClient = &mocks.MockClient{} util.RegisterAssetServiceHTTPClient = &mocks.MockClient{}
_, ctx := keeper.MachineKeeper(t) _, ctx := keeper.MachineKeeper(t)
params := types.DefaultParams() params := types.DefaultParams()