Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cli tests for auth module #6096

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
014caf8
Added cli integration base setup
sahith-narahari Apr 14, 2020
a42c097
Merge branch 'master' of github.com:cosmos/cosmos-sdk into sahith/add…
sahith-narahari Apr 14, 2020
df53367
Added cmd to simapp
sahith-narahari Apr 15, 2020
c2e22b9
Fixed ci-lint issues
sahith-narahari Apr 15, 2020
13b5531
Fixed ci-lint issues
sahith-narahari Apr 15, 2020
858e744
Addressed changes in Makefile
sahith-narahari Apr 16, 2020
0755f09
Merge branch 'master' of github.com:cosmos/cosmos-sdk into sahith/add…
sahith-narahari Apr 16, 2020
0ae1966
Updated simd to latest
sahith-narahari Apr 16, 2020
6f362fd
Removed testnet and replay commands
sahith-narahari Apr 17, 2020
5136a91
Modified tx command for simcli
sahith-narahari Apr 17, 2020
295b023
Merge branch 'master' of github.com:cosmos/cosmos-sdk into sahith/add…
sahith-narahari Apr 17, 2020
df2424a
Merge branch 'master' of github.com:cosmos/cosmos-sdk into sahith/add…
sahith-narahari Apr 17, 2020
da5b8e3
Did code cleanup
sahith-narahari Apr 17, 2020
6e82b44
Merge branch 'sahith/add-cli-tests' of github.com:regen-network/cosmo…
sahith-narahari Apr 18, 2020
0ef94f2
Removed duplication in Makefile
sahith-narahari Apr 18, 2020
6670f90
Refactored cli_test
sahith-narahari Apr 20, 2020
e130c40
Merge branch 'master' of github.com:cosmos/cosmos-sdk into sahith/add…
sahith-narahari Apr 20, 2020
bc88c76
Added build-sim to Makefile
sahith-narahari Apr 20, 2020
baa4b60
Added test-cli to circleci
sahith-narahari Apr 20, 2020
828092c
Merge branch 'master' of github.com:cosmos/cosmos-sdk into sahith/add…
sahith-narahari Apr 20, 2020
85fae47
Added tests for staking txns
Apr 21, 2020
5d33cbd
Addressed format issues
sahith-narahari Apr 21, 2020
349e09d
Merge branch 'sahith/add-staking-tests' of github.com:regen-network/c…
sahith-narahari Apr 21, 2020
61b6692
refctored tests code
Apr 21, 2020
0258675
Added tests for send, staking
sahith-narahari Apr 21, 2020
8815250
Merge remote-tracking branch 'origin/atheesh/cli-test-send' into athe…
sahith-narahari Apr 21, 2020
1b9c2ec
Removed test_hepers file
sahith-narahari Apr 21, 2020
3101ed3
Moved test_cover to contrib
sahith-narahari Apr 21, 2020
09efc33
Merge branch 'master' of github.com:cosmos/cosmos-sdk into sahith/add…
sahith-narahari Apr 21, 2020
93f1b09
Added codec in fixtures
Apr 22, 2020
cf27dff
Merge pull request #32 from vitwit/atheesh/cli-test-send
kaustubhkapatral Apr 22, 2020
d31c20d
Migrated tests to respective modules
sahith-narahari Apr 22, 2020
c083a83
Exported helper methods
sahith-narahari Apr 23, 2020
4f03138
Merge branch 'sahith/add-base-setup' of github.com:regen-network/cosm…
sahith-narahari Apr 23, 2020
82c0abc
Moved helpers to bank
sahith-narahari Apr 23, 2020
e67c965
Added codec to fixtures
sahith-narahari Apr 23, 2020
71365b7
Migrated tests to modules
sahith-narahari Apr 23, 2020
878bf70
Removed auth helpers from staking
sahith-narahari Apr 23, 2020
b272b89
Did minor code cleanup
sahith-narahari Apr 23, 2020
c94c654
Merge branch 'master' of github.com:cosmos/cosmos-sdk into sahith/add…
sahith-narahari Apr 23, 2020
b3335b4
Added test-cli to Makefile
sahith-narahari Apr 23, 2020
6f79058
Merge pull request #33 from regen-network/sahith/add-staking-tests
sahith-narahari Apr 24, 2020
2fb801c
Updated github actions
sahith-narahari Apr 24, 2020
b867814
Merge branch 'sahith/add-base-setup' of github.com:regen-network/cosm…
sahith-narahari Apr 24, 2020
f41876b
Did code refactor
sahith-narahari Apr 24, 2020
8237441
Fixed github actions for cli-test
sahith-narahari Apr 24, 2020
7197e7d
Merge branch 'master' of github.com:cosmos/cosmos-sdk into sahith/add…
sahith-narahari Apr 24, 2020
2600b5d
Merge branch 'master' of github.com:cosmos/cosmos-sdk into sahith/add…
sahith-narahari Apr 27, 2020
107091e
Added tests for recover keys and fee deduction
sahith-narahari Apr 27, 2020
044d318
Did minor code cleanup
sahith-narahari Apr 27, 2020
6e90919
Added build flag to cli_tests
sahith-narahari Apr 27, 2020
5fc398c
Moved cli_test to tests
sahith-narahari Apr 27, 2020
f351b47
Merge branch 'master' into sahith/add-base-setup
aaronc Apr 28, 2020
e400f11
Modified path in Makefile
sahith-narahari Apr 28, 2020
53e8e9c
Merge branch 'sahith/add-base-setup' of github.com:regen-network/cosm…
sahith-narahari Apr 28, 2020
e3913ae
Updated codec std in fixtures
sahith-narahari Apr 28, 2020
8454ecc
Added doc for cli tests
sahith-narahari Apr 28, 2020
0b167c6
Remove ibc genesis validation
anilcse Apr 28, 2020
55b8d0d
Fix issue number
anilcse Apr 28, 2020
446b283
Merge branch 'sahith/add-base-setup' of github.com:regen-network/cosm…
sahith-narahari Apr 29, 2020
01c14f7
Added missing imports
sahith-narahari Apr 29, 2020
664ed28
Add tests for distribution and simd
sahith-narahari Apr 29, 2020
4899346
Modified naming for test functions
sahith-narahari Apr 29, 2020
cb1afad
Merge branch 'sahith/add-fee-tests' of github.com:regen-network/cosmo…
sahith-narahari Apr 29, 2020
46bcce1
Added tests for auth
sahith-narahari Apr 29, 2020
4006270
Merge branch 'master' of github.com:cosmos/cosmos-sdk into sahith/add…
sahith-narahari Apr 29, 2020
48fccf1
Merge branch 'master' of github.com:cosmos/cosmos-sdk into sahith/add…
sahith-narahari May 1, 2020
61c46cc
Modified imports in auth test
sahith-narahari May 1, 2020
533cb82
Removed duplicate test functions
sahith-narahari May 1, 2020
aa56313
Run make format
sahith-narahari May 1, 2020
d33c151
Move auth tests to cli
sahith-narahari May 2, 2020
6cd57d9
Restructure module cli tests
sahith-narahari May 2, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ test-race:

test-integration: build-sim
BUILDDIR=$(BUILDDIR) go test -mod=readonly -p 4 `go list ./tests/cli/...` -tags=-tags='ledger test_ledger_mock cli_test'
BUILDDIR=$(BUILDDIR) go test -mod=readonly -p 4 `go list ./x/.../client/cli_test/...` -tags=-tags='ledger test_ledger_mock cli_test'
BUILDDIR=$(BUILDDIR) go test -mod=readonly -p 4 `go list ./x/.../client/cli/...` -tags=-tags='ledger test_ledger_mock cli_test'

.PHONY: test test-all test-ledger-mock test-ledger test-unit test-race

Expand Down
28 changes: 16 additions & 12 deletions tests/cli/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package cli
import (
"encoding/json"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"strings"
Expand Down Expand Up @@ -168,18 +169,6 @@ func (f *Fixtures) CLIConfig(key, value string, flags ...string) {
ExecuteWriteCheckErr(f.T, AddFlags(cmd, flags))
}

// TxBroadcast is simcli tx broadcast
func (f *Fixtures) TxBroadcast(fileName string, flags ...string) (bool, string, string) {
cmd := fmt.Sprintf("%s tx broadcast %v %v", f.SimcliBinary, f.Flags(), fileName)
return ExecuteWriteRetStdStreams(f.T, AddFlags(cmd, flags), clientkeys.DefaultKeyPass)
}

// TxEncode is simcli tx encode
func (f *Fixtures) TxEncode(fileName string, flags ...string) (bool, string, string) {
cmd := fmt.Sprintf("%s tx encode %v %v", f.SimcliBinary, f.Flags(), fileName)
return ExecuteWriteRetStdStreams(f.T, AddFlags(cmd, flags), clientkeys.DefaultKeyPass)
}

//utils

func AddFlags(cmd string, flags []string) string {
Expand All @@ -189,6 +178,21 @@ func AddFlags(cmd string, flags []string) string {
return strings.TrimSpace(cmd)
}

// Write the given string to a new temporary file
func WriteToNewTempFile(t *testing.T, s string) *os.File {
fp, err := ioutil.TempFile(os.TempDir(), "cosmos_cli_test_")
require.Nil(t, err)
_, err = fp.WriteString(s)
require.Nil(t, err)
return fp
}

func MarshalStdTx(t *testing.T, c *codec.Codec, stdTx auth.StdTx) []byte {
bz, err := c.MarshalBinaryBare(stdTx)
require.NoError(t, err)
return bz
}

func UnmarshalStdTx(t *testing.T, c *codec.Codec, s string) (stdTx auth.StdTx) {
require.Nil(t, c.UnmarshalJSON([]byte(s), &stdTx))
return
Expand Down
3 changes: 2 additions & 1 deletion tests/cli/keys_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ import (
"fmt"
"testing"

"github.com/cosmos/cosmos-sdk/tests/cli"
"github.com/stretchr/testify/require"

"github.com/cosmos/cosmos-sdk/tests/cli"
)

func TestCLIKeysAddMultisig(t *testing.T) {
Expand Down
12 changes: 7 additions & 5 deletions tests/cli/simd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@ package cli_test

import (
"fmt"
"io/ioutil"
"path/filepath"
"testing"

"github.com/stretchr/testify/require"
tmtypes "github.com/tendermint/tendermint/types"

"github.com/cosmos/cosmos-sdk/std"
"github.com/cosmos/cosmos-sdk/tests/cli"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/auth"
"github.com/cosmos/cosmos-sdk/x/bank"
"github.com/stretchr/testify/require"
tmtypes "github.com/tendermint/tendermint/types"
"io/ioutil"
"path/filepath"
"testing"
)

func TestSimdCollectGentxs(t *testing.T) {
Expand Down
Loading