Skip to content

Commit

Permalink
fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
swelf19 committed Sep 27, 2023
1 parent a52bfa8 commit 1dd39da
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions x/wasm/client/cli/genesis_msg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ import (

var wasmIdent = []byte("\x00\x61\x73\x6D")

var myWellFundedAccount = keeper.RandomBech32AccountAddress(nil)

const defaultTestKeyName = "my-key-name"

func TestGenesisStoreCodeCmd(t *testing.T) {
myWellFundedAccount := keeper.RandomBech32AccountAddress(t)

minimalWasmGenesis := types.GenesisState{
Params: types.DefaultParams(),
}
Expand Down Expand Up @@ -86,7 +86,7 @@ func TestGenesisStoreCodeCmd(t *testing.T) {
}
for msg, spec := range specs {
t.Run(msg, func(t *testing.T) {
homeDir := setupGenesis(t, spec.srcGenesis)
homeDir := setupGenesis(t, spec.srcGenesis, myWellFundedAccount)

// when
cmd := GenesisStoreCodeCmd(homeDir, NewDefaultGenesisIO())
Expand All @@ -105,6 +105,8 @@ func TestGenesisStoreCodeCmd(t *testing.T) {
}

func TestInstantiateContractCmd(t *testing.T) {
myWellFundedAccount := keeper.RandomBech32AccountAddress(t)

minimalWasmGenesis := types.GenesisState{
Params: types.DefaultParams(),
}
Expand Down Expand Up @@ -360,7 +362,7 @@ func TestInstantiateContractCmd(t *testing.T) {
}
for msg, spec := range specs {
t.Run(msg, func(t *testing.T) {
homeDir := setupGenesis(t, spec.srcGenesis)
homeDir := setupGenesis(t, spec.srcGenesis, myWellFundedAccount)

// when
cmd := GenesisInstantiateContractCmd(homeDir, NewDefaultGenesisIO())
Expand All @@ -379,6 +381,8 @@ func TestInstantiateContractCmd(t *testing.T) {
}

func TestExecuteContractCmd(t *testing.T) {
myWellFundedAccount := keeper.RandomBech32AccountAddress(t)

const firstContractAddress = "cosmos14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s4hmalr"
anyValidWasmFile, err := os.CreateTemp(t.TempDir(), "wasm")
require.NoError(t, err)
Expand Down Expand Up @@ -525,7 +529,7 @@ func TestExecuteContractCmd(t *testing.T) {
}
for msg, spec := range specs {
t.Run(msg, func(t *testing.T) {
homeDir := setupGenesis(t, spec.srcGenesis)
homeDir := setupGenesis(t, spec.srcGenesis, myWellFundedAccount)
cmd := GenesisExecuteContractCmd(homeDir, NewDefaultGenesisIO())
spec.mutator(cmd)

Expand Down Expand Up @@ -641,7 +645,8 @@ func TestGetAllContracts(t *testing.T) {
}
}

func setupGenesis(t *testing.T, wasmGenesis types.GenesisState) string {
func setupGenesis(t *testing.T, wasmGenesis types.GenesisState, myWellFundedAccount string) string {

appCodec := keeper.MakeEncodingConfig(t).Codec
homeDir := t.TempDir()

Expand Down

0 comments on commit 1dd39da

Please sign in to comment.