Use new test contract with failure modes, and fix all calls

This commit is contained in:
Ethan Frey
2020-02-07 19:04:01 +01:00
parent 678d0d7691
commit b30f96a551
6 changed files with 6 additions and 6 deletions

View File

@@ -101,7 +101,7 @@ func TestInitGenesis(t *testing.T) {
execCmd := MsgExecuteContract{
Sender: fred,
Contract: contractAddr,
Msg: []byte("{}"),
Msg: []byte(`{"release":{}}`),
SentFunds: topUp,
}
res, err = h(data.ctx, execCmd)

View File

@@ -221,7 +221,7 @@ func TestExecute(t *testing.T) {
// unauthorized - trialCtx so we don't change state
trialCtx := ctx.WithMultiStore(ctx.MultiStore().CacheWrap().(sdk.MultiStore))
res, err := keeper.Execute(trialCtx, addr, creator, []byte(`{}`), nil)
res, err := keeper.Execute(trialCtx, addr, creator, []byte(`{"release":{}}`), nil)
require.Error(t, err)
require.Contains(t, err.Error(), "Unauthorized")
@@ -229,14 +229,14 @@ func TestExecute(t *testing.T) {
start := time.Now()
gasBefore := ctx.GasMeter().GasConsumed()
res, err = keeper.Execute(ctx, addr, fred, []byte(`{}`), topUp)
res, err = keeper.Execute(ctx, addr, fred, []byte(`{"release":{}}`), topUp)
diff := time.Now().Sub(start)
require.NoError(t, err)
require.NotNil(t, res)
// make sure gas is properly deducted from ctx
gasAfter := ctx.GasMeter().GasConsumed()
require.Equal(t, uint64(31728), gasAfter-gasBefore)
require.Equal(t, uint64(31754), gasAfter-gasBefore)
// ensure bob now exists and got both payments released
bobAcct = accKeeper.GetAccount(ctx, bob)

View File

@@ -177,7 +177,7 @@ func TestMaskReflectContractSend(t *testing.T) {
// we also send an additional 14k tokens there.
// this should reduce the mask balance by 14k (to 26k)
// this 14k is added to the escrow, then the entire balance is sent to bob (total: 39k)
approveMsg := "{}"
approveMsg := `{"release":{}}`
msg := wasmTypes.CosmosMsg{
Contract: &wasmTypes.ContractMsg{
ContractAddr: escrowAddr.String(),

Binary file not shown.

View File

@@ -239,7 +239,7 @@ func TestHandleExecute(t *testing.T) {
execCmd := MsgExecuteContract{
Sender: fred,
Contract: contractAddr,
Msg: []byte("{}"),
Msg: []byte(`{"release":{}}`),
SentFunds: topUp,
}
res, err = h(data.ctx, execCmd)