Add FlipKick log events transformer

This commit is contained in:
Elizabeth
2018-08-07 10:51:34 -05:00
committed by GitHub
parent 66decaaa78
commit c617cd9c9d
1066 changed files with 200929 additions and 95 deletions
+17
View File
@@ -5,6 +5,8 @@ import (
. "github.com/onsi/gomega"
"github.com/ethereum/go-ethereum"
"github.com/ethereum/go-ethereum/core/types"
"github.com/vulcanize/vulcanizedb/pkg/core"
)
@@ -17,6 +19,8 @@ type MockBlockChain struct {
fetchContractDataPassedResult interface{}
fetchContractDataPassedBlockNumber int64
getBlockByNumberErr error
logQuery ethereum.FilterQuery
logQueryErr error
lastBlock *big.Int
node core.Node
}
@@ -39,6 +43,15 @@ func (blockChain *MockBlockChain) SetGetBlockByNumberErr(err error) {
blockChain.getBlockByNumberErr = err
}
func (blockChain *MockBlockChain) SetGetLogsErr(err error) {
blockChain.logQueryErr = err
}
func (blockChain *MockBlockChain) GetEthLogsWithCustomQuery(query ethereum.FilterQuery) ([]types.Log, error) {
blockChain.logQuery = query
return []types.Log{}, blockChain.logQueryErr
}
func (blockChain *MockBlockChain) GetHeaderByNumber(blockNumber int64) (core.Header, error) {
return core.Header{BlockNumber: blockNumber}, nil
}
@@ -81,3 +94,7 @@ func (blockChain *MockBlockChain) AssertFetchContractDataCalledWith(abiJSON stri
Expect(blockChain.fetchContractDataPassedResult).To(Equal(result))
Expect(blockChain.fetchContractDataPassedBlockNumber).To(Equal(blockNumber))
}
func (blockChain *MockBlockChain) AssertGetEthLogsWithCustomQueryCalledWith(query ethereum.FilterQuery) {
Expect(blockChain.logQuery).To(Equal(query))
}
+8 -11
View File
@@ -8,18 +8,15 @@ import (
)
type MockRpcClient struct {
ipcPath string
nodeType core.NodeType
ipcPath string
nodeType core.NodeType
supportedModules map[string]string
}
func NewMockRpcClient() *MockRpcClient {
return &MockRpcClient{}
}
func (client *MockRpcClient) SetNodeType(nodeType core.NodeType) {
client.nodeType = nodeType
}
func (client *MockRpcClient) SetIpcPath(ipcPath string) {
client.ipcPath = ipcPath
}
@@ -65,9 +62,9 @@ func (client *MockRpcClient) IpcPath() string {
}
func (client *MockRpcClient) SupportedModules() (map[string]string, error) {
result := make(map[string]string)
if client.nodeType == core.GETH {
result["admin"] = "ok"
}
return result, nil
return client.supportedModules, nil
}
func (client *MockRpcClient) SetSupporedModules(supportedModules map[string]string) {
client.supportedModules = supportedModules
}