Mockgen import cycle not allowed && recover missing mockgens (#824)

This commit is contained in:
Adrià Cidre 2018-04-13 15:10:37 +02:00 committed by GitHub
parent 5014e4e3b0
commit e277ae8b2d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 48 additions and 85 deletions

View File

@ -112,8 +112,10 @@ mock-install: ##@other Install mocking tools
go get -u github.com/golang/mock/mockgen go get -u github.com/golang/mock/mockgen
mock: ##@other Regenerate mocks mock: ##@other Regenerate mocks
mockgen -package=fcm -destination=geth/notifications/push/fcm/client_mock.go github.com/status-im/status-go/geth/notifications/push/fcm FirebaseClient,Notifier mockgen -package=fcm -destination=geth/notifications/push/fcm/client_mock.go -source=geth/notifications/push/fcm/client.go
mockgen -package=fake -destination=geth/transactions/fake/mock.go github.com/status-im/status-go/geth/transactions/fake PublicTransactionPoolAPI mockgen -package=fake -destination=geth/transactions/fake/mock.go -source=geth/transactions/fake/txservice.go
mockgen -package=account -destination=geth/account/accounts_mock.go -source=geth/account/accounts.go
mockgen -package=jail -destination=geth/jail/cell_mock.go -source=geth/jail/cell.go
docker-test: ##@tests Run tests in a docker container with golang. docker-test: ##@tests Run tests in a docker container with golang.
docker run --privileged --rm -it -v "$(shell pwd):$(DOCKER_TEST_WORKDIR)" -w "$(DOCKER_TEST_WORKDIR)" $(DOCKER_TEST_IMAGE) go test ${ARGS} docker run --privileged --rm -it -v "$(shell pwd):$(DOCKER_TEST_WORKDIR)" -w "$(DOCKER_TEST_WORKDIR)" $(DOCKER_TEST_IMAGE) go test ${ARGS}

View File

@ -1,15 +1,14 @@
// Code generated by MockGen. DO NOT EDIT. // Code generated by MockGen. DO NOT EDIT.
// Source: geth/account/accounts.go // Source: geth/account/accounts.go
// Package transactions is a generated GoMock package. // Package account is a generated GoMock package.
package account package account
import ( import (
reflect "reflect"
accounts "github.com/ethereum/go-ethereum/accounts" accounts "github.com/ethereum/go-ethereum/accounts"
keystore "github.com/ethereum/go-ethereum/accounts/keystore" keystore "github.com/ethereum/go-ethereum/accounts/keystore"
gomock "github.com/golang/mock/gomock" gomock "github.com/golang/mock/gomock"
reflect "reflect"
) )
// MockGethServiceProvider is a mock of GethServiceProvider interface // MockGethServiceProvider is a mock of GethServiceProvider interface

View File

@ -1,5 +1,5 @@
// Code generated by MockGen. DO NOT EDIT. // Code generated by MockGen. DO NOT EDIT.
// Source: cell.go // Source: geth/jail/cell.go
// Package jail is a generated GoMock package. // Package jail is a generated GoMock package.
package jail package jail

View File

@ -1,10 +1,12 @@
package fcm package fcm
import "github.com/NaySoftware/go-fcm" import (
gofcm "github.com/NaySoftware/go-fcm"
)
// FirebaseClient is a copy of "go-fcm" client methods. // FirebaseClient is a copy of "go-fcm" client methods.
type FirebaseClient interface { type FirebaseClient interface {
NewFcmRegIdsMsg(tokens []string, body interface{}) *fcm.FcmClient NewFcmRegIdsMsg(tokens []string, body interface{}) *gofcm.FcmClient
Send() (*fcm.FcmResponseStatus, error) Send() (*gofcm.FcmResponseStatus, error)
SetNotificationPayload(payload *fcm.NotificationPayload) *fcm.FcmClient SetNotificationPayload(payload *gofcm.NotificationPayload) *gofcm.FcmClient
} }

View File

@ -1,5 +1,5 @@
// Code generated by MockGen. DO NOT EDIT. // Code generated by MockGen. DO NOT EDIT.
// Source: github.com/status-im/status-go/geth/notifications/push/fcm (interfaces: FirebaseClient,Notifier) // Source: geth/notifications/push/fcm/client.go
// Package fcm is a generated GoMock package. // Package fcm is a generated GoMock package.
package fcm package fcm
@ -34,15 +34,15 @@ func (m *MockFirebaseClient) EXPECT() *MockFirebaseClientMockRecorder {
} }
// NewFcmRegIdsMsg mocks base method // NewFcmRegIdsMsg mocks base method
func (m *MockFirebaseClient) NewFcmRegIdsMsg(arg0 []string, arg1 interface{}) *go_fcm.FcmClient { func (m *MockFirebaseClient) NewFcmRegIdsMsg(tokens []string, body interface{}) *go_fcm.FcmClient {
ret := m.ctrl.Call(m, "NewFcmRegIdsMsg", arg0, arg1) ret := m.ctrl.Call(m, "NewFcmRegIdsMsg", tokens, body)
ret0, _ := ret[0].(*go_fcm.FcmClient) ret0, _ := ret[0].(*go_fcm.FcmClient)
return ret0 return ret0
} }
// NewFcmRegIdsMsg indicates an expected call of NewFcmRegIdsMsg // NewFcmRegIdsMsg indicates an expected call of NewFcmRegIdsMsg
func (mr *MockFirebaseClientMockRecorder) NewFcmRegIdsMsg(arg0, arg1 interface{}) *gomock.Call { func (mr *MockFirebaseClientMockRecorder) NewFcmRegIdsMsg(tokens, body interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewFcmRegIdsMsg", reflect.TypeOf((*MockFirebaseClient)(nil).NewFcmRegIdsMsg), arg0, arg1) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewFcmRegIdsMsg", reflect.TypeOf((*MockFirebaseClient)(nil).NewFcmRegIdsMsg), tokens, body)
} }
// Send mocks base method // Send mocks base method
@ -59,53 +59,13 @@ func (mr *MockFirebaseClientMockRecorder) Send() *gomock.Call {
} }
// SetNotificationPayload mocks base method // SetNotificationPayload mocks base method
func (m *MockFirebaseClient) SetNotificationPayload(arg0 *go_fcm.NotificationPayload) *go_fcm.FcmClient { func (m *MockFirebaseClient) SetNotificationPayload(payload *go_fcm.NotificationPayload) *go_fcm.FcmClient {
ret := m.ctrl.Call(m, "SetNotificationPayload", arg0) ret := m.ctrl.Call(m, "SetNotificationPayload", payload)
ret0, _ := ret[0].(*go_fcm.FcmClient) ret0, _ := ret[0].(*go_fcm.FcmClient)
return ret0 return ret0
} }
// SetNotificationPayload indicates an expected call of SetNotificationPayload // SetNotificationPayload indicates an expected call of SetNotificationPayload
func (mr *MockFirebaseClientMockRecorder) SetNotificationPayload(arg0 interface{}) *gomock.Call { func (mr *MockFirebaseClientMockRecorder) SetNotificationPayload(payload interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetNotificationPayload", reflect.TypeOf((*MockFirebaseClient)(nil).SetNotificationPayload), arg0) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetNotificationPayload", reflect.TypeOf((*MockFirebaseClient)(nil).SetNotificationPayload), payload)
}
// MockNotifier is a mock of Notifier interface
type MockNotifier struct {
ctrl *gomock.Controller
recorder *MockNotifierMockRecorder
}
// MockNotifierMockRecorder is the mock recorder for MockNotifier
type MockNotifierMockRecorder struct {
mock *MockNotifier
}
// NewMockNotifier creates a new mock instance
func NewMockNotifier(ctrl *gomock.Controller) *MockNotifier {
mock := &MockNotifier{ctrl: ctrl}
mock.recorder = &MockNotifierMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use
func (m *MockNotifier) EXPECT() *MockNotifierMockRecorder {
return m.recorder
}
// Send mocks base method
func (m *MockNotifier) Send(arg0 string, arg1 go_fcm.NotificationPayload, arg2 ...string) error {
varargs := []interface{}{arg0, arg1}
for _, a := range arg2 {
varargs = append(varargs, a)
}
ret := m.ctrl.Call(m, "Send", varargs...)
ret0, _ := ret[0].(error)
return ret0
}
// Send indicates an expected call of Send
func (mr *MockNotifierMockRecorder) Send(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {
varargs := append([]interface{}{arg0, arg1}, arg2...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Send", reflect.TypeOf((*MockNotifier)(nil).Send), varargs...)
} }

View File

@ -1,5 +1,5 @@
// Code generated by MockGen. DO NOT EDIT. // Code generated by MockGen. DO NOT EDIT.
// Source: github.com/status-im/status-go/geth/transactions/fake (interfaces: PublicTransactionPoolAPI) // Source: geth/transactions/fake/txservice.go
// Package fake is a generated GoMock package. // Package fake is a generated GoMock package.
package fake package fake
@ -37,54 +37,54 @@ func (m *MockPublicTransactionPoolAPI) EXPECT() *MockPublicTransactionPoolAPIMoc
return m.recorder return m.recorder
} }
// EstimateGas mocks base method
func (m *MockPublicTransactionPoolAPI) EstimateGas(arg0 context.Context, arg1 CallArgs) (hexutil.Uint64, error) {
ret := m.ctrl.Call(m, "EstimateGas", arg0, arg1)
ret0, _ := ret[0].(hexutil.Uint64)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// EstimateGas indicates an expected call of EstimateGas
func (mr *MockPublicTransactionPoolAPIMockRecorder) EstimateGas(arg0, arg1 interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EstimateGas", reflect.TypeOf((*MockPublicTransactionPoolAPI)(nil).EstimateGas), arg0, arg1)
}
// GasPrice mocks base method // GasPrice mocks base method
func (m *MockPublicTransactionPoolAPI) GasPrice(arg0 context.Context) (*big.Int, error) { func (m *MockPublicTransactionPoolAPI) GasPrice(ctx context.Context) (*big.Int, error) {
ret := m.ctrl.Call(m, "GasPrice", arg0) ret := m.ctrl.Call(m, "GasPrice", ctx)
ret0, _ := ret[0].(*big.Int) ret0, _ := ret[0].(*big.Int)
ret1, _ := ret[1].(error) ret1, _ := ret[1].(error)
return ret0, ret1 return ret0, ret1
} }
// GasPrice indicates an expected call of GasPrice // GasPrice indicates an expected call of GasPrice
func (mr *MockPublicTransactionPoolAPIMockRecorder) GasPrice(arg0 interface{}) *gomock.Call { func (mr *MockPublicTransactionPoolAPIMockRecorder) GasPrice(ctx interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GasPrice", reflect.TypeOf((*MockPublicTransactionPoolAPI)(nil).GasPrice), arg0) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GasPrice", reflect.TypeOf((*MockPublicTransactionPoolAPI)(nil).GasPrice), ctx)
}
// EstimateGas mocks base method
func (m *MockPublicTransactionPoolAPI) EstimateGas(ctx context.Context, args CallArgs) (hexutil.Uint64, error) {
ret := m.ctrl.Call(m, "EstimateGas", ctx, args)
ret0, _ := ret[0].(hexutil.Uint64)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// EstimateGas indicates an expected call of EstimateGas
func (mr *MockPublicTransactionPoolAPIMockRecorder) EstimateGas(ctx, args interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EstimateGas", reflect.TypeOf((*MockPublicTransactionPoolAPI)(nil).EstimateGas), ctx, args)
} }
// GetTransactionCount mocks base method // GetTransactionCount mocks base method
func (m *MockPublicTransactionPoolAPI) GetTransactionCount(arg0 context.Context, arg1 common.Address, arg2 rpc.BlockNumber) (*hexutil.Uint64, error) { func (m *MockPublicTransactionPoolAPI) GetTransactionCount(ctx context.Context, address common.Address, blockNr rpc.BlockNumber) (*hexutil.Uint64, error) {
ret := m.ctrl.Call(m, "GetTransactionCount", arg0, arg1, arg2) ret := m.ctrl.Call(m, "GetTransactionCount", ctx, address, blockNr)
ret0, _ := ret[0].(*hexutil.Uint64) ret0, _ := ret[0].(*hexutil.Uint64)
ret1, _ := ret[1].(error) ret1, _ := ret[1].(error)
return ret0, ret1 return ret0, ret1
} }
// GetTransactionCount indicates an expected call of GetTransactionCount // GetTransactionCount indicates an expected call of GetTransactionCount
func (mr *MockPublicTransactionPoolAPIMockRecorder) GetTransactionCount(arg0, arg1, arg2 interface{}) *gomock.Call { func (mr *MockPublicTransactionPoolAPIMockRecorder) GetTransactionCount(ctx, address, blockNr interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTransactionCount", reflect.TypeOf((*MockPublicTransactionPoolAPI)(nil).GetTransactionCount), arg0, arg1, arg2) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetTransactionCount", reflect.TypeOf((*MockPublicTransactionPoolAPI)(nil).GetTransactionCount), ctx, address, blockNr)
} }
// SendRawTransaction mocks base method // SendRawTransaction mocks base method
func (m *MockPublicTransactionPoolAPI) SendRawTransaction(arg0 context.Context, arg1 hexutil.Bytes) (common.Hash, error) { func (m *MockPublicTransactionPoolAPI) SendRawTransaction(ctx context.Context, encodedTx hexutil.Bytes) (common.Hash, error) {
ret := m.ctrl.Call(m, "SendRawTransaction", arg0, arg1) ret := m.ctrl.Call(m, "SendRawTransaction", ctx, encodedTx)
ret0, _ := ret[0].(common.Hash) ret0, _ := ret[0].(common.Hash)
ret1, _ := ret[1].(error) ret1, _ := ret[1].(error)
return ret0, ret1 return ret0, ret1
} }
// SendRawTransaction indicates an expected call of SendRawTransaction // SendRawTransaction indicates an expected call of SendRawTransaction
func (mr *MockPublicTransactionPoolAPIMockRecorder) SendRawTransaction(arg0, arg1 interface{}) *gomock.Call { func (mr *MockPublicTransactionPoolAPIMockRecorder) SendRawTransaction(ctx, encodedTx interface{}) *gomock.Call {
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendRawTransaction", reflect.TypeOf((*MockPublicTransactionPoolAPI)(nil).SendRawTransaction), arg0, arg1) return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendRawTransaction", reflect.TypeOf((*MockPublicTransactionPoolAPI)(nil).SendRawTransaction), ctx, encodedTx)
} }