2020-02-14 07:30:51 -08:00
|
|
|
package gov_test
|
2019-04-15 09:25:04 -07:00
|
|
|
|
|
|
|
import (
|
|
|
|
"strings"
|
|
|
|
"testing"
|
|
|
|
|
2020-07-20 05:30:12 -07:00
|
|
|
"github.com/cosmos/cosmos-sdk/testutil/testdata"
|
2020-07-06 10:03:45 -07:00
|
|
|
|
2020-02-14 07:30:51 -08:00
|
|
|
"github.com/stretchr/testify/require"
|
2019-06-26 09:03:25 -07:00
|
|
|
abci "github.com/tendermint/tendermint/abci/types"
|
2019-04-15 09:25:04 -07:00
|
|
|
|
2019-07-22 08:26:42 -07:00
|
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
2020-02-14 07:30:51 -08:00
|
|
|
"github.com/cosmos/cosmos-sdk/x/gov"
|
2020-06-13 02:07:51 -07:00
|
|
|
"github.com/cosmos/cosmos-sdk/x/gov/keeper"
|
2019-04-15 09:25:04 -07:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestInvalidMsg(t *testing.T) {
|
2020-06-13 02:07:51 -07:00
|
|
|
k := keeper.Keeper{}
|
2020-02-14 07:30:51 -08:00
|
|
|
h := gov.NewHandler(k)
|
2019-04-15 09:25:04 -07:00
|
|
|
|
2020-07-06 10:03:45 -07:00
|
|
|
res, err := h(sdk.NewContext(nil, abci.Header{}, false, nil), testdata.NewTestMsg())
|
2019-12-27 09:57:54 -08:00
|
|
|
require.Error(t, err)
|
|
|
|
require.Nil(t, res)
|
|
|
|
require.True(t, strings.Contains(err.Error(), "unrecognized gov message type"))
|
2019-04-15 09:25:04 -07:00
|
|
|
}
|