use time consistently in tests

This commit is contained in:
rhuairahrighairigh 2019-12-07 15:08:07 +00:00
parent d8347fd49c
commit f794ba1bf9
5 changed files with 9 additions and 9 deletions

View File

@ -5,9 +5,9 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/kava-labs/kava/app"
"github.com/kava-labs/kava/x/cdp"
"github.com/kava-labs/kava/x/pricefeed"
"github.com/kava-labs/kava/app"
)
// Avoid cluttering test cases with long function name
@ -30,7 +30,7 @@ func NewPFGenState(asset string, price sdk.Dec) app.GenesisState {
MarketID: asset,
OracleAddress: sdk.AccAddress{},
Price: price,
Expiry: time.Unix(9999999999, 0), // some deterministic future date,
Expiry: time.Now().Add(1 * time.Hour),
},
},
}

View File

@ -29,7 +29,7 @@ func NewPricefeedGenState(asset string, price sdk.Dec) app.GenesisState {
MarketID: asset,
OracleAddress: sdk.AccAddress{},
Price: price,
Expiry: time.Unix(9999999999, 0), // some deterministic future date,
Expiry: time.Now().Add(1 * time.Hour),
},
},
}
@ -67,13 +67,13 @@ func NewPricefeedGenStateMulti() app.GenesisState {
MarketID: "btc",
OracleAddress: sdk.AccAddress{},
Price: sdk.MustNewDecFromStr("8000.00"),
Expiry: time.Unix(9999999999, 0), // some deterministic future date,
Expiry: time.Now().Add(1 * time.Hour),
},
pricefeed.PostedPrice{
MarketID: "xrp",
OracleAddress: sdk.AccAddress{},
Price: sdk.MustNewDecFromStr("0.25"),
Expiry: time.Unix(9999999999, 0), // some deterministic future date,
Expiry: time.Now().Add(1 * time.Hour),
},
},
}

View File

@ -164,7 +164,7 @@ func TestKeeper_PartialSeizeCDP(t *testing.T) {
// Reduce price
tApp.GetPriceFeedKeeper().SetPrice(
ctx, sdk.AccAddress{}, collateral,
d("0.90"), time.Unix(9999999999, 0)) // some deterministic future date
d("0.90"), time.Now().Add(1*time.Hour))
tApp.GetPriceFeedKeeper().SetCurrentPrices(ctx, collateral)
// Seize entire CDP

View File

@ -31,7 +31,7 @@ func NewPricefeedGenState(asset string, price sdk.Dec) app.GenesisState {
MarketID: asset,
OracleAddress: sdk.AccAddress{},
Price: price,
Expiry: time.Unix(9999999999, 0), // some deterministic future date,
Expiry: time.Now().Add(1 * time.Hour),
},
},
}

View File

@ -28,7 +28,7 @@ func TestKeeper_SeizeAndStartCollateralAuction(t *testing.T) {
require.NoError(t, tApp.GetCDPKeeper().ModifyCDP(ctx, addrs[0], "btc", i(3), i(16000)))
_, err := tApp.GetPriceFeedKeeper().SetPrice(ctx, addrs[0], "btc", d("7999.99"), time.Unix(9999999999, 0))
_, err := tApp.GetPriceFeedKeeper().SetPrice(ctx, addrs[0], "btc", d("7999.99"), time.Now().Add(1*time.Hour))
require.NoError(t, err)
require.NoError(t, tApp.GetPriceFeedKeeper().SetCurrentPrices(ctx, "btc"))