* Make JSONMarshaler require proto.Message * Use &msg with MarshalJSON * Use *LegacyAmino in queriers instead of JSONMarshaler * Revert ABCIMessageLogs String() and coins tests * Use LegacyAmino in client/debug and fix subspace tests * Use LegacyAmino in all legacy queriers and adapt simulation * Make AminoCodec implement Marshaler and some godoc fixes * Test fixes * Remove unrelevant comment * Use TxConfig.TxJSONEncoder * Use encoding/json in genutil cli migrate/validate genesis cmds * Address simulation related comments * Use JSONMarshaler in cli tests * Use proto.Message as respType in cli tests * Use tmjson for tm GenesisDoc * Update types/module/simulation.go Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com> * Update types/module/module_test.go Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com> * Add godoc comments * Remove unused InsertKeyJSON * Fix tests Co-authored-by: Aaron Craelius <aaronc@users.noreply.github.com> Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
40 lines
1008 B
Go
40 lines
1008 B
Go
package common
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"github.com/cosmos/cosmos-sdk/client"
|
|
"github.com/cosmos/cosmos-sdk/x/distribution/types"
|
|
)
|
|
|
|
func TestQueryDelegationRewardsAddrValidation(t *testing.T) {
|
|
clientCtx := client.Context{}.WithLegacyAmino(types.ModuleCdc.LegacyAmino)
|
|
|
|
type args struct {
|
|
delAddr string
|
|
valAddr string
|
|
}
|
|
|
|
tests := []struct {
|
|
name string
|
|
args args
|
|
want []byte
|
|
wantErr bool
|
|
}{
|
|
{"invalid delegator address", args{"invalid", ""}, nil, true},
|
|
{"empty delegator address", args{"", ""}, nil, true},
|
|
{"invalid validator address", args{"cosmos1zxcsu7l5qxs53lvp0fqgd09a9r2g6kqrk2cdpa", "invalid"}, nil, true},
|
|
{"empty validator address", args{"cosmos1zxcsu7l5qxs53lvp0fqgd09a9r2g6kqrk2cdpa", ""}, nil, true},
|
|
}
|
|
|
|
for _, tt := range tests {
|
|
tt := tt
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
_, _, err := QueryDelegationRewards(clientCtx, tt.args.delAddr, tt.args.valAddr)
|
|
require.True(t, err != nil, tt.wantErr)
|
|
})
|
|
}
|
|
}
|