Skip to content

Commit

Permalink
push
Browse files Browse the repository at this point in the history
  • Loading branch information
czarcas7ic committed Feb 1, 2024
1 parent 2df36aa commit 6012369
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 17 deletions.
42 changes: 27 additions & 15 deletions tests/e2e/auth/vesting/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package testutil

import (
"fmt"
"log"
"os"

"github.com/cosmos/gogoproto/proto"
"github.com/stretchr/testify/suite"
Expand Down Expand Up @@ -221,6 +223,11 @@ func (s *E2ETestSuite) TestNewMsgCreatePermanentLockedAccountCmd() {
}

func (s *E2ETestSuite) TestNewMsgCreateClawbackVestingAccountCmd() {
pwd, err := os.Getwd()
if err != nil {
log.Fatal(err)
}
fmt.Println(pwd)
val := s.network.Validators[0]
for _, tc := range []struct {
name string
Expand All @@ -234,8 +241,8 @@ func (s *E2ETestSuite) TestNewMsgCreateClawbackVestingAccountCmd() {
args: []string{
sdk.AccAddress("addr10______________").String(),
fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address),
fmt.Sprintf("--%s=%s", cli.FlagLockup, "testdata/period1.json"),
fmt.Sprintf("--%s=%s", cli.FlagVesting, "testdata/period1.json"),
fmt.Sprintf("--%s=%s", cli.FlagLockup, fmt.Sprintf(pwd+"/testdata/periods1.json")),
fmt.Sprintf("--%s=%s", cli.FlagVesting, fmt.Sprintf(pwd+"/testdata/periods1.json")),
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync),
fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()),
Expand All @@ -249,7 +256,7 @@ func (s *E2ETestSuite) TestNewMsgCreateClawbackVestingAccountCmd() {
args: []string{
sdk.AccAddress("addr11______________").String(),
fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address),
fmt.Sprintf("--%s=%s", cli.FlagVesting, "testdata/period1.json"),
fmt.Sprintf("--%s=%s", cli.FlagVesting, fmt.Sprintf(pwd+"/testdata/periods1.json")),
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync),
fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()),
Expand All @@ -263,7 +270,7 @@ func (s *E2ETestSuite) TestNewMsgCreateClawbackVestingAccountCmd() {
args: []string{
sdk.AccAddress("addr12______________").String(),
fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address),
fmt.Sprintf("--%s=%s", cli.FlagLockup, "testdata/period1.json"),
fmt.Sprintf("--%s=%s", cli.FlagLockup, fmt.Sprintf(pwd+"/testdata/periods1.json")),
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync),
fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()),
Expand All @@ -277,8 +284,8 @@ func (s *E2ETestSuite) TestNewMsgCreateClawbackVestingAccountCmd() {
args: []string{
sdk.AccAddress("addr10______________").String(),
fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address),
fmt.Sprintf("--%s=%s", cli.FlagLockup, "testdata/period1.json"),
fmt.Sprintf("--%s=%s", cli.FlagVesting, "testdata/period1.json"),
fmt.Sprintf("--%s=%s", cli.FlagLockup, fmt.Sprintf(pwd+"/testdata/periods1.json")),
fmt.Sprintf("--%s=%s", cli.FlagVesting, fmt.Sprintf(pwd+"/testdata/periods1.json")),
fmt.Sprintf("--%s=%s", cli.FlagMerge, "true"),
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync),
Expand Down Expand Up @@ -306,47 +313,47 @@ func (s *E2ETestSuite) TestNewMsgCreateClawbackVestingAccountCmd() {
name: "bad lockup filename",
args: []string{
sdk.AccAddress("addr13______________").String(),
fmt.Sprintf("--%s=%s", cli.FlagLockup, "testdata/noexist"),
fmt.Sprintf("--%s=%s", cli.FlagLockup, fmt.Sprintf(pwd+"testdata/noexist")),
},
expectErr: true,
},
{
name: "bad lockup json",
args: []string{
sdk.AccAddress("addr13______________").String(),
fmt.Sprintf("--%s=%s", cli.FlagLockup, "testdata/badjson"),
fmt.Sprintf("--%s=%s", cli.FlagLockup, fmt.Sprintf(pwd+"testdata/badjson")),
},
expectErr: true,
},
{
name: "bad lockup periods",
args: []string{
sdk.AccAddress("addr13______________").String(),
fmt.Sprintf("--%s=%s", cli.FlagLockup, "testdata/badperiod.json"),
fmt.Sprintf("--%s=%s", cli.FlagLockup, fmt.Sprintf(pwd+"testdata/badperiod.json")),
},
expectErr: true,
},
{
name: "bad vesting filename",
args: []string{
sdk.AccAddress("addr13______________").String(),
fmt.Sprintf("--%s=%s", cli.FlagVesting, "testdata/noexist"),
fmt.Sprintf("--%s=%s", cli.FlagVesting, fmt.Sprintf(pwd+"testdata/noexist")),
},
expectErr: true,
},
{
name: "bad vesting json",
args: []string{
sdk.AccAddress("addr13______________").String(),
fmt.Sprintf("--%s=%s", cli.FlagVesting, "testdata/badjson"),
fmt.Sprintf("--%s=%s", cli.FlagVesting, fmt.Sprintf(pwd+"testdata/badjson")),
},
expectErr: true,
},
{
name: "bad vesting periods",
args: []string{
sdk.AccAddress("addr13______________").String(),
fmt.Sprintf("--%s=%s", cli.FlagVesting, "testdata/badperiod.json"),
fmt.Sprintf("--%s=%s", cli.FlagVesting, fmt.Sprintf(pwd+"testdata/badperiod.json")),
},
expectErr: true,
},
Expand All @@ -369,14 +376,19 @@ func (s *E2ETestSuite) TestNewMsgCreateClawbackVestingAccountCmd() {
}

func (s *E2ETestSuite) TestNewMsgClawbackCmd() {
pwd, err := os.Getwd()
if err != nil {
log.Fatal(err)
}

val := s.network.Validators[0]
addr := sdk.AccAddress("addr30______________")

_, err := clitestutil.ExecTestCLICmd(val.ClientCtx, cli.NewMsgCreateClawbackVestingAccountCmd(), []string{
_, err = clitestutil.ExecTestCLICmd(val.ClientCtx, cli.NewMsgCreateClawbackVestingAccountCmd(), []string{
addr.String(),
fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address),
fmt.Sprintf("--%s=%s", cli.FlagLockup, "testdata/period1.json"),
fmt.Sprintf("--%s=%s", cli.FlagVesting, "testdata/period1.json"),
fmt.Sprintf("--%s=%s", cli.FlagLockup, fmt.Sprintf(pwd+"/testdata/periods1.json")),
fmt.Sprintf("--%s=%s", cli.FlagVesting, fmt.Sprintf(pwd+"/testdata/periods1.json")),
fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation),
fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync),
fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(s.cfg.BondDenom, sdk.NewInt(10))).String()),
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/auth/vesting/testdata/periods1.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
"periods": [
{
"coins": "10stake",
"length": 2592000
"length_seconds": 2592000
},
{
"coins": "10stake",
"length":2592000
"length_seconds":2592000
}
]
}

0 comments on commit 6012369

Please sign in to comment.