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

refactor: writing test case for module account incentivizing packet #1397

Merged
merged 4 commits into from
Jun 22, 2022
Merged
Changes from 1 commit
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
13 changes: 12 additions & 1 deletion modules/apps/29-fee/keeper/msg_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package keeper_test
import (
sdk "github.com/cosmos/cosmos-sdk/types"

disttypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
"github.com/cosmos/ibc-go/v3/modules/apps/29-fee/types"
clienttypes "github.com/cosmos/ibc-go/v3/modules/core/02-client/types"
channeltypes "github.com/cosmos/ibc-go/v3/modules/core/04-channel/types"
Expand Down Expand Up @@ -76,6 +77,7 @@ func (suite *KeeperTestSuite) TestPayPacketFee() {
expEscrowBalance sdk.Coins
expFeesInEscrow []types.PacketFee
msg *types.MsgPayPacketFee
fee types.Fee
)

testCases := []struct {
Expand Down Expand Up @@ -106,6 +108,15 @@ func (suite *KeeperTestSuite) TestPayPacketFee() {
},
true,
},
{
"refund account is module account",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking at it now, it might make more sense to put this in the escrow test suite

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it'd be nice if there was a test for distributing to a module acc

func() {
msg.Signer = suite.chainA.GetSimApp().AccountKeeper.GetModuleAddress(disttypes.ModuleName).String()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can maybe remove this test case now?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it worth keeping this in, and just change disttypes.ModuleName to mock.ModuleName?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. It's worth keeping it.

expPacketFee := types.NewPacketFee(fee, msg.Signer, nil)
expFeesInEscrow = []types.PacketFee{expPacketFee}
},
true,
},
{
"fee module is locked",
func() {
Expand Down Expand Up @@ -165,7 +176,7 @@ func (suite *KeeperTestSuite) TestPayPacketFee() {
suite.SetupTest()
suite.coordinator.Setup(suite.path) // setup channel

fee := types.NewFee(defaultRecvFee, defaultAckFee, defaultTimeoutFee)
fee = types.NewFee(defaultRecvFee, defaultAckFee, defaultTimeoutFee)
msg = types.NewMsgPayPacketFee(
fee,
suite.path.EndpointA.ChannelConfig.PortID,
Expand Down