cosmos-sdk/x/distribution/client/common/common_test.go
Alessio Treglia e7e3c32204 Merge PR #3553: Code cleanup, take #1
* add a bunch of tests, add DONTCOVER text tag

- Also fix flaky test (closes: #3559). Don't test values
  returned by queries since there's no way to query a
  specific height via REST.

* GetTempDir -> NewTestCaseDir
2019-02-08 22:45:41 +01:00

37 lines
978 B
Go

package common
import (
"testing"
"github.com/stretchr/testify/require"
"github.com/cosmos/cosmos-sdk/client/context"
"github.com/cosmos/cosmos-sdk/codec"
)
func TestQueryDelegationRewardsAddrValidation(t *testing.T) {
cdc := codec.New()
ctx := context.NewCLIContext().WithCodec(cdc)
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 {
t.Run(tt.name, func(t *testing.T) {
_, err := QueryDelegationRewards(ctx, cdc, "", tt.args.delAddr, tt.args.valAddr)
require.True(t, err != nil, tt.wantErr)
})
}
}