-
Notifications
You must be signed in to change notification settings - Fork 675
/
Copy pathaccount_test.go
32 lines (23 loc) · 1.05 KB
/
account_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package keeper_test
import (
sdk "github.com/cosmos/cosmos-sdk/types"
icatypes "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/types"
)
func (suite *KeeperTestSuite) TestRegisterInterchainAccount() {
suite.SetupTest()
path := NewICAPath(suite.chainA, suite.chainB)
suite.coordinator.SetupConnections(path)
//RegisterInterchainAccount
err := SetupICAPath(path, TestOwnerAddress)
suite.Require().NoError(err)
portID, err := icatypes.NewControllerPortID(TestOwnerAddress)
suite.Require().NoError(err)
// Get the address of the interchain account stored in state during handshake step
storedAddr, found := suite.chainB.GetSimApp().ICAHostKeeper.GetInterchainAccountAddress(suite.chainB.GetContext(), portID)
suite.Require().True(found)
icaAddr, err := sdk.AccAddressFromBech32(storedAddr)
suite.Require().NoError(err)
// Check if account is created
interchainAccount := suite.chainB.GetSimApp().AccountKeeper.GetAccount(suite.chainB.GetContext(), icaAddr)
suite.Require().Equal(interchainAccount.GetAddress().String(), storedAddr)
}