Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
aljo242 committed Dec 4, 2023
1 parent 33298b9 commit e6c2b69
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions tests/integration/network_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
package integration_test

import (
"fmt"
"github.com/cosmos/cosmos-sdk/x/auth/types"
"github.com/stretchr/testify/require"
"google.golang.org/grpc/codes"
"strconv"
"testing"

tmcli "github.com/cometbft/cometbft/libs/cli"
"github.com/stretchr/testify/suite"

"github.com/skip-mev/feemarket/testutils/networksuite"
)

// QueryTestSuite is a test suite for query tests
Expand All @@ -15,3 +23,57 @@ type NetworkTestSuite struct {
func TestNetworkTestSuite(t *testing.T) {
suite.Run(t, new(NetworkTestSuite))
}

func (suite *NetworkTestSuite) TestShowGenesisAccount() {
ctx := suite.Network.Validators[0].ClientCtx

common := []string{
fmt.Sprintf("--%s=json", tmcli.OutputFlag),
}
for _, tc := range []struct {
desc string
idLaunchID string
idAddress string

args []string
err error
obj types.GenesisAccount
}{
{
desc: "should show an existing genesis account",
idLaunchID: strconv.Itoa(int(accs[0].LaunchID)),
idAddress: accs[0].Address,

args: common,
obj: accs[0],
},
{
desc: "should send error for a non existing genesis account",
idLaunchID: strconv.Itoa(100000),
idAddress: strconv.Itoa(100000),

args: common,
err: status.Error(codes.NotFound, "not found"),
},
} {
suite.T().Run(tc.desc, func(t *testing.T) {
args := []string{
tc.idLaunchID,
tc.idAddress,
}
args = append(args, tc.args...)
out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdShowGenesisAccount(), args)
if tc.err != nil {
stat, ok := status.FromError(tc.err)
require.True(t, ok)
require.ErrorIs(t, stat.Err(), tc.err)
} else {
require.NoError(t, err)
var resp types.QueryGetGenesisAccountResponse
require.NoError(t, suite.Network.Config.Codec.UnmarshalJSON(out.Bytes(), &resp))
require.NotNil(t, resp.GenesisAccount)
require.Equal(t, tc.obj, resp.GenesisAccount)
}
})
}
}

0 comments on commit e6c2b69

Please sign in to comment.