update tests

This commit is contained in:
rhuairahrighairigh 2018-09-20 11:36:42 -04:00
parent 2e1ecc1724
commit caa290a957
3 changed files with 15 additions and 20 deletions

7
Gopkg.lock generated
View File

@ -48,7 +48,7 @@
revision = "d4cc87b860166d00d6b5b9e0d3b3d71d6088d4d4"
[[projects]]
digest = "1:f3b0e995c000b2caa93309b8202a599326b708583d60aec2eef668bea2827c9d"
digest = "1:485c3fd6d387a850672e86b89eabf32d0363890652c1b499898c925a5e8a02ce"
name = "github.com/cosmos/cosmos-sdk"
packages = [
"baseapp",
@ -58,7 +58,6 @@
"client/rpc",
"client/tx",
"client/utils",
"cmd/gaia/app",
"crypto",
"crypto/keys",
"crypto/keys/bcrypt",
@ -79,9 +78,6 @@
"x/bank/client",
"x/bank/client/cli",
"x/bank/client/rest",
"x/gov",
"x/gov/tags",
"x/ibc",
"x/mock",
"x/params",
"x/slashing",
@ -682,7 +678,6 @@
"github.com/cosmos/cosmos-sdk/client/rpc",
"github.com/cosmos/cosmos-sdk/client/tx",
"github.com/cosmos/cosmos-sdk/client/utils",
"github.com/cosmos/cosmos-sdk/cmd/gaia/app",
"github.com/cosmos/cosmos-sdk/crypto/keys",
"github.com/cosmos/cosmos-sdk/server",
"github.com/cosmos/cosmos-sdk/server/config",

View File

@ -254,7 +254,7 @@ func TestCoinSend(t *testing.T) {
coins := acc.GetCoins()
mycoins := coins[0]
require.Equal(t, "steak", mycoins.Denom)
require.Equal(t, "KVA", mycoins.Denom)
require.Equal(t, initialBalance[0].Amount.SubRaw(1), mycoins.Amount)
// query receiver
@ -262,7 +262,7 @@ func TestCoinSend(t *testing.T) {
coins = acc.GetCoins()
mycoins = coins[0]
require.Equal(t, "steak", mycoins.Denom)
require.Equal(t, "KVA", mycoins.Denom)
require.Equal(t, int64(1), mycoins.Amount.Int64())
}
@ -356,7 +356,7 @@ func TestValidatorQuery(t *testing.T) {
}
func TestBonding(t *testing.T) {
name, password, denom := "test", "1234567890", "steak"
name, password, denom := "test", "1234567890", "KVA"
addr, seed := CreateAddr(t, "test", password, GetKeyBase(t))
cleanup, pks, port := InitializeTestLCD(t, 1, []sdk.AccAddress{addr})
defer cleanup()
@ -400,7 +400,7 @@ func TestBonding(t *testing.T) {
// query sender
acc = getAccount(t, port, addr)
coins = acc.GetCoins()
require.Equal(t, int64(40), coins.AmountOf("steak").Int64())
require.Equal(t, int64(40), coins.AmountOf("KVA").Int64())
// query unbonding delegation
validatorAddr := sdk.AccAddress(pks[0].Address())
@ -471,7 +471,7 @@ func doSend(t *testing.T, port, seed, name, password string, addr sdk.AccAddress
sequence := acc.GetSequence()
chainID := viper.GetString(client.FlagChainID)
// send
coinbz, err := cdc.MarshalJSON(sdk.NewInt64Coin("steak", 1))
coinbz, err := cdc.MarshalJSON(sdk.NewInt64Coin("KVA", 1))
if err != nil {
panic(err)
}
@ -582,7 +582,7 @@ func doDelegate(t *testing.T, port, seed, name, password string, delegatorAddr,
"complete_unbondings": [],
"begin_redelegates": [],
"complete_redelegates": []
}`, name, password, accnum, sequence, chainID, delegatorAddr, validatorAddr, "steak"))
}`, name, password, accnum, sequence, chainID, delegatorAddr, validatorAddr, "KVA"))
res, body := Request(t, port, "POST", fmt.Sprintf("/stake/delegators/%s/delegations", delegatorAddr), jsonStr)
require.Equal(t, http.StatusOK, res.StatusCode, body)

View File

@ -17,13 +17,13 @@ import (
"github.com/cosmos/cosmos-sdk/client"
keys "github.com/cosmos/cosmos-sdk/client/keys"
gapp "github.com/cosmos/cosmos-sdk/cmd/gaia/app"
crkeys "github.com/cosmos/cosmos-sdk/crypto/keys"
"github.com/cosmos/cosmos-sdk/server"
"github.com/cosmos/cosmos-sdk/tests"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/wire"
"github.com/cosmos/cosmos-sdk/x/auth"
kapp "github.com/kava-labs/kava/internal/app"
"github.com/spf13/viper"
"github.com/stretchr/testify/require"
@ -115,7 +115,7 @@ func CreateAddr(t *testing.T, name, password string, kb crkeys.Keybase) (sdk.Acc
// InitializeTestLCD starts Tendermint and the LCD in process, listening on
// their respective sockets where nValidators is the total number of validators
// and initAddrs are the accounts to initialize with some steak tokens. It
// and initAddrs are the accounts to initialize with some KVA tokens. It
// returns a cleanup function, a set of validator public keys, and a port.
func InitializeTestLCD(t *testing.T, nValidators int, initAddrs []sdk.AccAddress) (func(), []crypto.PubKey, string) {
config := GetConfig()
@ -131,8 +131,8 @@ func InitializeTestLCD(t *testing.T, nValidators int, initAddrs []sdk.AccAddress
privVal.Reset()
db := dbm.NewMemDB()
app := gapp.NewGaiaApp(logger, db, nil)
cdc = gapp.MakeCodec()
app := kapp.NewKavaApp(logger, db, nil)
cdc = kapp.CreateKavaAppCodec()
genesisFile := config.GenesisFile()
genDoc, err := tmtypes.GenesisDocFromFile(genesisFile)
@ -161,20 +161,20 @@ func InitializeTestLCD(t *testing.T, nValidators int, initAddrs []sdk.AccAddress
pk := gdValidator.PubKey
validatorsPKs = append(validatorsPKs, pk)
appGenTx, _, _, err := gapp.GaiaAppGenTxNF(cdc, pk, sdk.AccAddress(pk.Address()), "test_val1")
appGenTx, _, _, err := kapp.KavaAppGenTxNF(cdc, pk, sdk.AccAddress(pk.Address()), "test_val1")
require.NoError(t, err)
appGenTxs = append(appGenTxs, appGenTx)
}
genesisState, err := gapp.GaiaAppGenState(cdc, appGenTxs[:])
genesisState, err := kapp.KavaAppGenState(cdc, appGenTxs[:])
require.NoError(t, err)
// add some tokens to init accounts
for _, addr := range initAddrs {
accAuth := auth.NewBaseAccountWithAddress(addr)
accAuth.Coins = sdk.Coins{sdk.NewInt64Coin("steak", 100)}
acc := gapp.NewGenesisAccount(&accAuth)
accAuth.Coins = sdk.Coins{sdk.NewInt64Coin("KVA", 100)}
acc := kapp.NewGenesisAccount(&accAuth)
genesisState.Accounts = append(genesisState.Accounts, acc)
genesisState.StakeData.Pool.LooseTokens = genesisState.StakeData.Pool.LooseTokens.Add(sdk.NewRat(100))
}