Skip to content

Commit

Permalink
test: add helper function for creating ICA path
Browse files Browse the repository at this point in the history
  • Loading branch information
seantking committed Sep 10, 2021
1 parent f375a1f commit 477b9ba
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
21 changes: 21 additions & 0 deletions modules/apps/27-interchain-accounts/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,24 @@ func (suite *KeeperTestSuite) TestGetPort() {
port := suite.chainA.GetSimApp().ICAKeeper.GetPort(suite.chainA.GetContext())
suite.Require().Equal(types.PortID, port)
}

func (suite *KeeperTestSuite) SetupICAPath(path *ibctesting.Path, owner string) error {
if err := InitInterchainAccount(path.EndpointA, owner); err != nil {
return err
}

if err := path.EndpointB.ChanOpenTry(); err != nil {
return err
}

if err := path.EndpointA.ChanOpenAck(); err != nil {
return err
}

if err := suite.chainB.GetSimApp().ICAKeeper.OnChanOpenConfirm(suite.chainA.GetContext(),
path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID); err != nil {
return err
}

return nil
}
12 changes: 1 addition & 11 deletions modules/apps/27-interchain-accounts/keeper/relay_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,7 @@ func (suite *KeeperTestSuite) TestTrySendTx() {
owner := "owner"
suite.coordinator.SetupConnections(path)

err := InitInterchainAccount(path.EndpointA, owner)
suite.Require().NoError(err)

err = path.EndpointB.ChanOpenTry()
suite.Require().NoError(err)

err = path.EndpointA.ChanOpenAck()
suite.Require().NoError(err)

err = suite.chainB.GetSimApp().ICAKeeper.OnChanOpenConfirm(suite.chainA.GetContext(),
path.EndpointA.ChannelConfig.PortID, path.EndpointA.ChannelID)
err := suite.SetupICAPath(path, owner)
suite.Require().NoError(err)

tc.malleate()
Expand Down

0 comments on commit 477b9ba

Please sign in to comment.