Skip to content

Commit

Permalink
fix: updating to use test library instead of hardcoded values
Browse files Browse the repository at this point in the history
  • Loading branch information
seantking committed Sep 17, 2021
1 parent 61eae32 commit 4c27d87
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions modules/apps/27-interchain-accounts/types/account_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package types_test

import (
"encoding/json"
"fmt"
"testing"

"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
Expand Down Expand Up @@ -145,25 +146,24 @@ func (suite *TypesTestSuite) TestGenesisAccountValidate() {

func (suite *TypesTestSuite) TestInterchainAccountMarshalYAML() {
suite.SetupTest() // reset
addr, err := sdk.AccAddressFromHex("0000000000000000000000000000000000000000")
suite.Require().NoError(err)

addr := suite.chainA.SenderAccount.GetAddress()
ba := authtypes.NewBaseAccountWithAddress(addr)

interchainAcc := types.NewInterchainAccount(ba, "accountOwner")
interchainAcc := types.NewInterchainAccount(ba, suite.chainB.SenderAccount.GetAddress().String())

bs, err := yaml.Marshal(interchainAcc)
suite.Require().NoError(err)

want := "|\n address: cosmos1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqnrql8a\n public_key: \"\"\n account_number: 0\n sequence: 0\n account_owner: accountOwner\n"
want := fmt.Sprintf("|\n address: %s\n public_key: \"\"\n account_number: 0\n sequence: 0\n account_owner: %s\n", addr, interchainAcc.AccountOwner)
suite.Require().Equal(want, string(bs))
}

func (suite *TypesTestSuite) TestInterchainAccountJSON() {
pubkey := secp256k1.GenPrivKey().PubKey()
addr := sdk.AccAddress(pubkey.Address())
baseAcc := authtypes.NewBaseAccountWithAddress(addr)
addr := suite.chainA.SenderAccount.GetAddress()
ba := authtypes.NewBaseAccountWithAddress(addr)

interchainAcc := types.NewInterchainAccount(baseAcc, "owner-address")
interchainAcc := types.NewInterchainAccount(ba, suite.chainB.SenderAccount.GetAddress().String())

bz, err := json.Marshal(interchainAcc)
suite.Require().NoError(err)
Expand Down

0 comments on commit 4c27d87

Please sign in to comment.