From e3aca06236f4358609b9e2a8c89719bb8144781a Mon Sep 17 00:00:00 2001 From: rhuairahrighairigh Date: Thu, 5 Dec 2019 13:59:20 +0000 Subject: [PATCH] update cdp tests to use CheckBalance method --- x/cdp/app_test.go | 10 ++++------ x/cdp/keeper/keeper_test.go | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/x/cdp/app_test.go b/x/cdp/app_test.go index 684bb00c..8dabeb3b 100644 --- a/x/cdp/app_test.go +++ b/x/cdp/app_test.go @@ -3,8 +3,6 @@ package cdp_test import ( "testing" - "github.com/stretchr/testify/require" - "github.com/cosmos/cosmos-sdk/simapp" sdk "github.com/cosmos/cosmos-sdk/types" abci "github.com/tendermint/tendermint/abci/types" @@ -25,7 +23,7 @@ func TestApp_CreateModifyDeleteCDP(t *testing.T) { ) // check balance ctx := tApp.NewContext(false, abci.Header{}) - require.Equal(t, cs(c("xrp", 100)), tApp.GetAccountKeeper().GetAccount(ctx, testAddr).GetCoins()) + tApp.CheckBalance(t, ctx, testAddr, cs(c("xrp", 100))) // setup cdp keeper keeper := tApp.GetCDPKeeper() @@ -62,7 +60,7 @@ func TestApp_CreateModifyDeleteCDP(t *testing.T) { // check balance ctx = tApp.NewContext(true, abci.Header{}) - require.Equal(t, cs(c("usdx", 5), c("xrp", 90)), tApp.GetAccountKeeper().GetAccount(ctx, testAddr).GetCoins()) + tApp.CheckBalance(t, ctx, testAddr, cs(c("usdx", 5), c("xrp", 90))) // Modify CDP msgs = []sdk.Msg{cdp.NewMsgCreateOrModifyCDP(testAddr, "xrp", i(40), i(5))} @@ -70,7 +68,7 @@ func TestApp_CreateModifyDeleteCDP(t *testing.T) { // check balance ctx = tApp.NewContext(true, abci.Header{}) - require.Equal(t, cs(c("usdx", 10), c("xrp", 50)), tApp.GetAccountKeeper().GetAccount(ctx, testAddr).GetCoins()) + tApp.CheckBalance(t, ctx, testAddr, cs(c("usdx", 10), c("xrp", 50))) // Delete CDP msgs = []sdk.Msg{cdp.NewMsgCreateOrModifyCDP(testAddr, "xrp", i(-50), i(-10))} @@ -78,5 +76,5 @@ func TestApp_CreateModifyDeleteCDP(t *testing.T) { // check balance ctx = tApp.NewContext(true, abci.Header{}) - require.Equal(t, cs(c("xrp", 100)), tApp.GetAccountKeeper().GetAccount(ctx, testAddr).GetCoins()) + tApp.CheckBalance(t, ctx, testAddr, cs(c("xrp", 100))) } diff --git a/x/cdp/keeper/keeper_test.go b/x/cdp/keeper/keeper_test.go index 184623cd..aeed1a6a 100644 --- a/x/cdp/keeper/keeper_test.go +++ b/x/cdp/keeper/keeper_test.go @@ -160,7 +160,7 @@ func TestKeeper_ModifyCDP(t *testing.T) { require.Equal(t, tc.expectedState.GlobalDebt, actualGDebt) require.Equal(t, tc.expectedState.CollateralState, actualCstate) // check owner balance - require.Equal(t, tc.expectedState.OwnerCoins, tApp.GetAccountKeeper().GetAccount(ctx, ownerAddr).GetCoins()) + tApp.CheckBalance(t, ctx, ownerAddr, tc.expectedState.OwnerCoins) }) } }