x/auth: turn sign --validate-sigantures into a standalone command (#6108)
--validate-signatures should not be a flag of the sign command
as the operation performed (transaction signatures verification)
is logically distinct.
cli_test is and has always been an horrible name for package
directory as it's very much Go anti-idiomatic - _test is the
suffix used by test packages, not directories. Plus, CLI test
cases can and should live alongside other testcases that don't
require binaries to be built beforehand. Thus:
x/module/client/cli_test/*.go -> x/module/client/cli/
Test files that require sim{cli,d} shall be tagged with // +build cli_test
With regard to cli test auxiliary functions, they should live in:
x/module/client/testutil/
Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com>
This commit is contained in:
co-authored by
Alexander Bezobchuk
parent
54ecf7d629
commit
2414e5bdd4
@@ -6,7 +6,6 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
@@ -182,7 +181,14 @@ func AddFlags(cmd string, flags []string) string {
|
||||
return strings.TrimSpace(cmd)
|
||||
}
|
||||
|
||||
func UnmarshalStdTx(t *testing.T, c *codec.Codec, s string) (stdTx auth.StdTx) {
|
||||
func UnmarshalStdTx(t require.TestingT, c *codec.Codec, s string) (stdTx auth.StdTx) {
|
||||
require.Nil(t, c.UnmarshalJSON([]byte(s), &stdTx))
|
||||
return
|
||||
}
|
||||
|
||||
func MarshalStdTx(t require.TestingT, c *codec.Codec, stdTx auth.StdTx) []byte {
|
||||
bz, err := c.MarshalBinaryBare(stdTx)
|
||||
require.NoError(t, err)
|
||||
|
||||
return bz
|
||||
}
|
||||
|
||||
+12
-8
@@ -1,20 +1,24 @@
|
||||
// +build cli_test
|
||||
|
||||
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) {
|
||||
func TestCLISimdCollectGentxs(t *testing.T) {
|
||||
t.Parallel()
|
||||
var customMaxBytes, customMaxGas int64 = 99999999, 1234567
|
||||
f := cli.NewFixtures(t)
|
||||
@@ -62,7 +66,7 @@ func TestSimdCollectGentxs(t *testing.T) {
|
||||
f.Cleanup(gentxDir)
|
||||
}
|
||||
|
||||
func TestSimdAddGenesisAccount(t *testing.T) {
|
||||
func TestCLISimdAddGenesisAccount(t *testing.T) {
|
||||
t.Parallel()
|
||||
f := cli.NewFixtures(t)
|
||||
|
||||
@@ -113,7 +117,7 @@ func TestSimdAddGenesisAccount(t *testing.T) {
|
||||
f.Cleanup()
|
||||
}
|
||||
|
||||
func TestValidateGenesis(t *testing.T) {
|
||||
func TestCLIValidateGenesis(t *testing.T) {
|
||||
t.Parallel()
|
||||
f := cli.InitFixtures(t)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user