Consolidate test doubles

- Migrate various mocks of core namespaces to shared version in `fakes` pkg
- Err on the side of making test doubles less sophisticated
- Don't pull over mocks of namespaces that are only used in example code
This commit is contained in:
Rob Mulholand
2018-11-03 13:49:23 -05:00
committed by Ian Norden
parent 5fe6394406
commit ba071ef13f
46 changed files with 640 additions and 893 deletions
+1 -1
View File
@@ -2,7 +2,7 @@ package core
import "math/big"
type Blockchain interface {
type BlockChain interface {
ContractDataFetcher
GetBlockByNumber(blockNumber int64) (Block, error)
GetHeaderByNumber(blockNumber int64) (Header, error)
@@ -5,12 +5,15 @@ import (
"math/big"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
)
type Client interface {
type EthClient interface {
BlockByNumber(ctx context.Context, number *big.Int) (*types.Block, error)
CallContract(ctx context.Context, msg ethereum.CallMsg, blockNumber *big.Int) ([]byte, error)
FilterLogs(ctx context.Context, q ethereum.FilterQuery) ([]types.Log, error)
HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error)
TransactionSender(ctx context.Context, tx *types.Transaction, block common.Hash, index uint) (common.Address, error)
TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)
}
+9
View File
@@ -0,0 +1,9 @@
package core
import "context"
type RpcClient interface {
CallContext(ctx context.Context, result interface{}, method string, args ...interface{}) error
IpcPath() string
SupportedModules() (map[string]string, error)
}