@@ -453,6 +453,7 @@ func (s *IntegrationTestSuite) TestCLIQueryTxsCmdByEvents() {
453
453
testCases := []struct {
454
454
name string
455
455
args []string
456
+ expectErr bool
456
457
expectEmpty bool
457
458
}{
458
459
{
@@ -463,6 +464,7 @@ func (s *IntegrationTestSuite) TestCLIQueryTxsCmdByEvents() {
463
464
fmt .Sprintf ("--%s=json" , ostcli .OutputFlag ),
464
465
},
465
466
false ,
467
+ false ,
466
468
},
467
469
{
468
470
"no matching fee event" ,
@@ -471,6 +473,16 @@ func (s *IntegrationTestSuite) TestCLIQueryTxsCmdByEvents() {
471
473
sdk .NewCoins (sdk .NewCoin (s .cfg .BondDenom , sdk .NewInt (0 ))).String ()),
472
474
fmt .Sprintf ("--%s=json" , ostcli .OutputFlag ),
473
475
},
476
+ false ,
477
+ true ,
478
+ },
479
+ {
480
+ "wrong number of arguments" ,
481
+ []string {
482
+ "extra" ,
483
+ fmt .Sprintf ("--%s=json" , ostcli .OutputFlag ),
484
+ },
485
+ true ,
474
486
true ,
475
487
},
476
488
}
@@ -482,6 +494,10 @@ func (s *IntegrationTestSuite) TestCLIQueryTxsCmdByEvents() {
482
494
clientCtx := val .ClientCtx
483
495
484
496
out , err := clitestutil .ExecTestCLICmd (clientCtx , cmd , tc .args )
497
+ if tc .expectErr {
498
+ s .Require ().Error (err )
499
+ return
500
+ }
485
501
s .Require ().NoError (err )
486
502
487
503
var result sdk.SearchTxsResult
@@ -1122,16 +1138,43 @@ func (s *IntegrationTestSuite) TestGetAccountCmd() {
1122
1138
1123
1139
func (s * IntegrationTestSuite ) TestGetAccountsCmd () {
1124
1140
val := s .network .Validators [0 ]
1125
- clientCtx := val .ClientCtx
1126
1141
1127
- out , err := clitestutil . ExecTestCLICmd ( clientCtx , authcli . GetAccountsCmd (), []string {
1142
+ commonArgs := []string {
1128
1143
fmt .Sprintf ("--%s=json" , ostcli .OutputFlag ),
1129
- })
1130
- s .Require ().NoError (err )
1144
+ }
1131
1145
1132
- var res authtypes.QueryAccountsResponse
1133
- s .Require ().NoError (val .ClientCtx .Codec .UnmarshalJSON (out .Bytes (), & res ))
1134
- s .Require ().NotEmpty (res .Accounts )
1146
+ testCases := map [string ]struct {
1147
+ args []string
1148
+ valid bool
1149
+ }{
1150
+ "valid request" : {
1151
+ valid : true ,
1152
+ },
1153
+ "wrong number of args" : {
1154
+ args : []string {
1155
+ "extra" ,
1156
+ },
1157
+ },
1158
+ }
1159
+
1160
+ for name , tc := range testCases {
1161
+ tc := tc
1162
+ s .Run (name , func () {
1163
+ cmd := authcli .GetAccountsCmd ()
1164
+ clientCtx := val .ClientCtx
1165
+
1166
+ out , err := clitestutil .ExecTestCLICmd (clientCtx , cmd , append (tc .args , commonArgs ... ))
1167
+ if ! tc .valid {
1168
+ s .Require ().Error (err )
1169
+ return
1170
+ }
1171
+ s .Require ().NoError (err )
1172
+
1173
+ var res authtypes.QueryAccountsResponse
1174
+ s .Require ().NoError (val .ClientCtx .Codec .UnmarshalJSON (out .Bytes (), & res ))
1175
+ s .Require ().NotEmpty (res .Accounts )
1176
+ })
1177
+ }
1135
1178
}
1136
1179
1137
1180
func TestGetBroadcastCommandOfflineFlag (t * testing.T ) {
0 commit comments