-
Notifications
You must be signed in to change notification settings - Fork 28
/
test_helpers.go
48 lines (40 loc) · 1.09 KB
/
test_helpers.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package testutil
import (
"fmt"
"testing"
"github.com/cometbft/cometbft/libs/cli"
"github.com/cosmos/gogoproto/proto"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
recordcli "github.com/irisnet/irismod/modules/record/client/cli"
"github.com/irisnet/irismod/simapp"
)
// CreateRecordExec creates a redelegate message.
func CreateRecordExec(t *testing.T,
network simapp.Network,
clientCtx client.Context,
from string,
digest string,
digestAlgo string,
extraArgs ...string) *simapp.ResponseTx {
args := []string{
digest,
digestAlgo,
fmt.Sprintf("--%s=%s", flags.FlagFrom, from),
}
args = append(args, extraArgs...)
return network.ExecTxCmdWithResult(t, clientCtx, recordcli.GetCmdCreateRecord(), args)
}
func QueryRecordExec(t *testing.T,
network simapp.Network,
clientCtx client.Context,
recordID string,
resp proto.Message,
extraArgs ...string) {
args := []string{
recordID,
fmt.Sprintf("--%s=json", cli.OutputFlag),
}
args = append(args, extraArgs...)
network.ExecQueryCmd(t, clientCtx, recordcli.GetCmdQueryRecord(), args, resp)
}