forked from cerc-io/ipld-eth-server
d5c2ab33fc
= Add eth_node_fingerprint to block that can be imitated by both hot and cold imports - Only sync missing blocks (blocks that are missing or don't share a fingerprint) on cold import - Set block is_final status after import
39 lines
822 B
Go
39 lines
822 B
Go
package fakes
|
|
|
|
import . "github.com/onsi/gomega"
|
|
|
|
type MockFsReader struct {
|
|
readCalled bool
|
|
readPassedPath string
|
|
readReturnBytes []byte
|
|
readReturnErr error
|
|
}
|
|
|
|
func NewMockFsReader() *MockFsReader {
|
|
return &MockFsReader{
|
|
readCalled: false,
|
|
readPassedPath: "",
|
|
readReturnBytes: nil,
|
|
readReturnErr: nil,
|
|
}
|
|
}
|
|
|
|
func (mfr *MockFsReader) SetReturnBytes(returnBytes []byte) {
|
|
mfr.readReturnBytes = returnBytes
|
|
}
|
|
|
|
func (mfr *MockFsReader) SetReturnErr(err error) {
|
|
mfr.readReturnErr = err
|
|
}
|
|
|
|
func (mfr *MockFsReader) Read(path string) ([]byte, error) {
|
|
mfr.readCalled = true
|
|
mfr.readPassedPath = path
|
|
return mfr.readReturnBytes, mfr.readReturnErr
|
|
}
|
|
|
|
func (mfr *MockFsReader) AssertReadCalledWith(path string) {
|
|
Expect(mfr.readCalled).To(BeTrue())
|
|
Expect(mfr.readPassedPath).To(Equal(path))
|
|
}
|