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

test: updating ica grpc query tests #379

Merged
merged 1 commit into from
Sep 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion modules/apps/27-interchain-accounts/keeper/grpc_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package keeper

import (
"context"
"strings"

sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
Expand All @@ -20,7 +21,7 @@ func (k Keeper) InterchainAccountAddress(ctx context.Context, req *types.QueryIn
return nil, status.Error(codes.InvalidArgument, "empty request")
}

if req.CounterpartyPortId == "" {
if strings.TrimSpace(req.CounterpartyPortId) == "" {
return nil, status.Error(codes.InvalidArgument, "counterparty portID cannot be empty")
}

Expand Down
6 changes: 3 additions & 3 deletions modules/apps/27-interchain-accounts/keeper/grpc_query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ func (suite *KeeperTestSuite) TestQueryInterchainAccountAddress() {
{
"empty request",
func() {
req = &types.QueryInterchainAccountAddressRequest{}
req = nil
},
false,
},
{
"invalid counterparty portID",
func() {
req = &types.QueryInterchainAccountAddressRequest{
CounterpartyPortId: "",
CounterpartyPortId: " ",
}
},
false,
Expand Down Expand Up @@ -66,7 +66,7 @@ func (suite *KeeperTestSuite) TestQueryInterchainAccountAddress() {
tc.malleate()
ctx := sdk.WrapSDKContext(suite.chainA.GetContext())

res, err := suite.queryClient.InterchainAccountAddress(ctx, req)
res, err := suite.chainA.GetSimApp().ICAKeeper.InterchainAccountAddress(ctx, req)

if tc.expPass {
suite.Require().NoError(err)
Expand Down
7 changes: 0 additions & 7 deletions modules/apps/27-interchain-accounts/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package keeper_test
import (
"testing"

"github.com/cosmos/cosmos-sdk/baseapp"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
"github.com/stretchr/testify/suite"

Expand All @@ -21,19 +20,13 @@ type KeeperTestSuite struct {
chainA *ibctesting.TestChain
chainB *ibctesting.TestChain
chainC *ibctesting.TestChain

queryClient types.QueryClient
}

func (suite *KeeperTestSuite) SetupTest() {
suite.coordinator = ibctesting.NewCoordinator(suite.T(), 3)
suite.chainA = suite.coordinator.GetChain(ibctesting.GetChainID(0))
suite.chainB = suite.coordinator.GetChain(ibctesting.GetChainID(1))
suite.chainC = suite.coordinator.GetChain(ibctesting.GetChainID(2))

queryHelper := baseapp.NewQueryServerTestHelper(suite.chainA.GetContext(), suite.chainA.GetSimApp().InterfaceRegistry())
types.RegisterQueryServer(queryHelper, suite.chainA.GetSimApp().ICAKeeper)
suite.queryClient = types.NewQueryClient(queryHelper)
}

func NewICAPath(chainA, chainB *ibctesting.TestChain) *ibctesting.Path {
Expand Down