replace old mocks with new mock

This commit is contained in:
Callum
2020-04-28 12:59:18 +02:00
parent 08aa4765b0
commit 6dc971052a
4 changed files with 5 additions and 22 deletions

View File

@@ -12,6 +12,7 @@ import (
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/crypto/ed25519"
"github.com/tendermint/tendermint/crypto/secp256k1"
evmock "github.com/tendermint/tendermint/evidence/mock"
"github.com/tendermint/tendermint/libs/log"
"github.com/tendermint/tendermint/mock"
"github.com/tendermint/tendermint/proxy"
@@ -38,7 +39,7 @@ func TestApplyBlock(t *testing.T) {
state, stateDB, _ := makeState(1, 1)
blockExec := sm.NewBlockExecutor(stateDB, log.TestingLogger(), proxyApp.Consensus(),
mock.Mempool{}, sm.MockEvidencePool{})
mock.Mempool{}, evmock.NewDefaultEvidencePool())
block := makeBlock(state, 1)
blockID := types.BlockID{Hash: block.Hash(), PartsHeader: block.MakePartSet(testPartSize).Header()}
@@ -334,7 +335,7 @@ func TestEndBlockValidatorUpdates(t *testing.T) {
log.TestingLogger(),
proxyApp.Consensus(),
mock.Mempool{},
sm.MockEvidencePool{},
evmock.NewDefaultEvidencePool(),
)
eventBus := types.NewEventBus()
@@ -401,7 +402,7 @@ func TestEndBlockValidatorUpdatesResultingInEmptySet(t *testing.T) {
log.TestingLogger(),
proxyApp.Consensus(),
mock.Mempool{},
sm.MockEvidencePool{},
evmock.NewDefaultEvidencePool(),
)
block := makeBlock(state, 1)

View File

@@ -22,15 +22,6 @@ type paramsChangeTestCase struct {
params types.ConsensusParams
}
// always returns true if asked if any evidence was already committed.
type mockEvPoolAlwaysCommitted struct{}
func (m mockEvPoolAlwaysCommitted) PendingEvidence(int64) []types.Evidence { return nil }
func (m mockEvPoolAlwaysCommitted) AddEvidence(types.Evidence) error { return nil }
func (m mockEvPoolAlwaysCommitted) Update(*types.Block, sm.State) {}
func (m mockEvPoolAlwaysCommitted) IsCommitted(types.Evidence) bool { return true }
func (m mockEvPoolAlwaysCommitted) IsPending(types.Evidence) bool { return false }
func newTestApp() proxy.AppConns {
app := &testApp{}
cc := proxy.NewLocalClientCreator(app)

View File

@@ -45,12 +45,3 @@ type EvidencePool interface {
IsCommitted(types.Evidence) bool
IsPending(types.Evidence) bool
}
// MockEvidencePool is an empty implementation of EvidencePool, useful for testing.
type MockEvidencePool struct{}
func (m MockEvidencePool) PendingEvidence(int64) []types.Evidence { return nil }
func (m MockEvidencePool) AddEvidence(types.Evidence) error { return nil }
func (m MockEvidencePool) Update(*types.Block, State) {}
func (m MockEvidencePool) IsCommitted(types.Evidence) bool { return false }
func (m MockEvidencePool) IsPending(types.Evidence) bool { return false }

View File

@@ -29,7 +29,7 @@ func TestValidateBlockHeader(t *testing.T) {
log.TestingLogger(),
proxyApp.Consensus(),
mock.Mempool{},
sm.MockEvidencePool{},
evmock.NewDefaultEvidencePool(),
)
lastCommit := types.NewCommit(0, 0, types.BlockID{}, nil)