From acff8c0cf383ce0751ceba35db959f19d668a81e Mon Sep 17 00:00:00 2001 From: Damian Nolan Date: Mon, 6 Sep 2021 14:07:13 +0200 Subject: [PATCH] updating grpc query tests, removing queryClient on KeeperTestSuite --- modules/apps/27-interchain-accounts/keeper/grpc_query.go | 3 ++- .../apps/27-interchain-accounts/keeper/grpc_query_test.go | 6 +++--- modules/apps/27-interchain-accounts/keeper/keeper_test.go | 7 ------- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/modules/apps/27-interchain-accounts/keeper/grpc_query.go b/modules/apps/27-interchain-accounts/keeper/grpc_query.go index 205722addef..dacf55efeb1 100644 --- a/modules/apps/27-interchain-accounts/keeper/grpc_query.go +++ b/modules/apps/27-interchain-accounts/keeper/grpc_query.go @@ -2,6 +2,7 @@ package keeper import ( "context" + "strings" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -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") } diff --git a/modules/apps/27-interchain-accounts/keeper/grpc_query_test.go b/modules/apps/27-interchain-accounts/keeper/grpc_query_test.go index 6841f45963b..c5ea7a3cd84 100644 --- a/modules/apps/27-interchain-accounts/keeper/grpc_query_test.go +++ b/modules/apps/27-interchain-accounts/keeper/grpc_query_test.go @@ -23,7 +23,7 @@ func (suite *KeeperTestSuite) TestQueryInterchainAccountAddress() { { "empty request", func() { - req = &types.QueryInterchainAccountAddressRequest{} + req = nil }, false, }, @@ -31,7 +31,7 @@ func (suite *KeeperTestSuite) TestQueryInterchainAccountAddress() { "invalid counterparty portID", func() { req = &types.QueryInterchainAccountAddressRequest{ - CounterpartyPortId: "", + CounterpartyPortId: " ", } }, false, @@ -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) diff --git a/modules/apps/27-interchain-accounts/keeper/keeper_test.go b/modules/apps/27-interchain-accounts/keeper/keeper_test.go index 06e0e2530c8..d3cc61c8d6a 100644 --- a/modules/apps/27-interchain-accounts/keeper/keeper_test.go +++ b/modules/apps/27-interchain-accounts/keeper/keeper_test.go @@ -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" @@ -21,8 +20,6 @@ type KeeperTestSuite struct { chainA *ibctesting.TestChain chainB *ibctesting.TestChain chainC *ibctesting.TestChain - - queryClient types.QueryClient } func (suite *KeeperTestSuite) SetupTest() { @@ -30,10 +27,6 @@ func (suite *KeeperTestSuite) SetupTest() { 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 {