Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
akhilkumarpilli committed Sep 25, 2024
1 parent 621723c commit 2ce8237
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 53 deletions.
52 changes: 0 additions & 52 deletions tests/systemtests/authz_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,6 @@ func TestAuthzGrantTxCmd(t *testing.T) {
expErrMsg string
queryTx bool
}{
{
"not enough arguments",
grantee1Addr,
[]string{},
"accepts 2 arg(s), received 1",
false,
},
{
"invalid authorization type",
grantee1Addr,
Expand Down Expand Up @@ -239,51 +232,6 @@ func TestAuthzGrantTxCmd(t *testing.T) {
require.Len(t, grants, grantsCount)
}

func TestAuthzExecCmdBasicChecks(t *testing.T) {
// scenario: test authz exec command basic error cases
// given a running chain

sut.ResetChain(t)
cli := NewCLIWrapper(t, sut, verbose)

// get validator address which will be used as granter
granterAddr := cli.GetKeyAddr("node0")
require.NotEmpty(t, granterAddr)

execCmdArgs := []string{"tx", "authz", "exec"}

// test exec command basic checks
execErrTestCases := []struct {
name string
cmdArgs []string
expErrMsg string
}{
{
"not enough arguments",
[]string{"--from=" + granterAddr},
"accepts 1 arg(s), received 0",
},
{
"invalid json path",
[]string{"/invalid/file.txt", "--from=" + granterAddr},
"invalid argument",
},
}

for _, tc := range execErrTestCases {
cmd := append(execCmdArgs, tc.cmdArgs...)
t.Run(tc.name, func(t *testing.T) {
assertErr := func(_ assert.TestingT, gotErr error, gotOutputs ...interface{}) bool {
require.Len(t, gotOutputs, 1)
output := gotOutputs[0].(string)
require.Contains(t, output, tc.expErrMsg)
return false
}
_ = cli.WithRunErrorMatcher(assertErr).Run(cmd...)
})
}
}

func TestAuthzExecSendAuthorization(t *testing.T) {
// scenario: test authz exec send authorization
// given a running chain
Expand Down
2 changes: 1 addition & 1 deletion x/authz/module/autocli.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions {
Short: "Execute tx on behalf of granter account",
Example: fmt.Sprintf("$ %s tx authz exec msg.json --from grantee\n $ %[1]s tx bank send [granter] [recipient] [amount] --generate-only | jq .body.messages > msg.json && %[1]s tx authz exec msg.json --from grantee", version.AppName),
PositionalArgs: []*autocliv1.PositionalArgDescriptor{
{ProtoField: "msgs"},
{ProtoField: "msgs", Varargs: true},
},
},
{
Expand Down

0 comments on commit 2ce8237

Please sign in to comment.