From fb1f37648f7edf9314ccfbe7ef874765cce9e82c Mon Sep 17 00:00:00 2001 From: Mariano Cano Date: Mon, 26 Oct 2020 19:54:57 -0700 Subject: [PATCH] Add missing files, mocks created using mockgen. --- cas/cloudcas/mock_client_test.go | 157 ++++++++++++ cas/cloudcas/mock_operation_server_test.go | 270 +++++++++++++++++++++ 2 files changed, 427 insertions(+) create mode 100644 cas/cloudcas/mock_client_test.go create mode 100644 cas/cloudcas/mock_operation_server_test.go diff --git a/cas/cloudcas/mock_client_test.go b/cas/cloudcas/mock_client_test.go new file mode 100644 index 00000000..b81d3135 --- /dev/null +++ b/cas/cloudcas/mock_client_test.go @@ -0,0 +1,157 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: ./cas/cloudcas/cloudcas.go + +// Package cloudcas is a generated GoMock package. +package cloudcas + +import ( + privateca "cloud.google.com/go/security/privateca/apiv1beta1" + context "context" + gomock "github.com/golang/mock/gomock" + gax "github.com/googleapis/gax-go/v2" + privateca0 "google.golang.org/genproto/googleapis/cloud/security/privateca/v1beta1" + reflect "reflect" +) + +// MockCertificateAuthorityClient is a mock of CertificateAuthorityClient interface +type MockCertificateAuthorityClient struct { + ctrl *gomock.Controller + recorder *MockCertificateAuthorityClientMockRecorder +} + +// MockCertificateAuthorityClientMockRecorder is the mock recorder for MockCertificateAuthorityClient +type MockCertificateAuthorityClientMockRecorder struct { + mock *MockCertificateAuthorityClient +} + +// NewMockCertificateAuthorityClient creates a new mock instance +func NewMockCertificateAuthorityClient(ctrl *gomock.Controller) *MockCertificateAuthorityClient { + mock := &MockCertificateAuthorityClient{ctrl: ctrl} + mock.recorder = &MockCertificateAuthorityClientMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use +func (m *MockCertificateAuthorityClient) EXPECT() *MockCertificateAuthorityClientMockRecorder { + return m.recorder +} + +// CreateCertificate mocks base method +func (m *MockCertificateAuthorityClient) CreateCertificate(ctx context.Context, req *privateca0.CreateCertificateRequest, opts ...gax.CallOption) (*privateca0.Certificate, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, req} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "CreateCertificate", varargs...) + ret0, _ := ret[0].(*privateca0.Certificate) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateCertificate indicates an expected call of CreateCertificate +func (mr *MockCertificateAuthorityClientMockRecorder) CreateCertificate(ctx, req interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, req}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateCertificate", reflect.TypeOf((*MockCertificateAuthorityClient)(nil).CreateCertificate), varargs...) +} + +// RevokeCertificate mocks base method +func (m *MockCertificateAuthorityClient) RevokeCertificate(ctx context.Context, req *privateca0.RevokeCertificateRequest, opts ...gax.CallOption) (*privateca0.Certificate, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, req} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "RevokeCertificate", varargs...) + ret0, _ := ret[0].(*privateca0.Certificate) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// RevokeCertificate indicates an expected call of RevokeCertificate +func (mr *MockCertificateAuthorityClientMockRecorder) RevokeCertificate(ctx, req interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, req}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RevokeCertificate", reflect.TypeOf((*MockCertificateAuthorityClient)(nil).RevokeCertificate), varargs...) +} + +// GetCertificateAuthority mocks base method +func (m *MockCertificateAuthorityClient) GetCertificateAuthority(ctx context.Context, req *privateca0.GetCertificateAuthorityRequest, opts ...gax.CallOption) (*privateca0.CertificateAuthority, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, req} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "GetCertificateAuthority", varargs...) + ret0, _ := ret[0].(*privateca0.CertificateAuthority) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetCertificateAuthority indicates an expected call of GetCertificateAuthority +func (mr *MockCertificateAuthorityClientMockRecorder) GetCertificateAuthority(ctx, req interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, req}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCertificateAuthority", reflect.TypeOf((*MockCertificateAuthorityClient)(nil).GetCertificateAuthority), varargs...) +} + +// CreateCertificateAuthority mocks base method +func (m *MockCertificateAuthorityClient) CreateCertificateAuthority(ctx context.Context, req *privateca0.CreateCertificateAuthorityRequest, opts ...gax.CallOption) (*privateca.CreateCertificateAuthorityOperation, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, req} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "CreateCertificateAuthority", varargs...) + ret0, _ := ret[0].(*privateca.CreateCertificateAuthorityOperation) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateCertificateAuthority indicates an expected call of CreateCertificateAuthority +func (mr *MockCertificateAuthorityClientMockRecorder) CreateCertificateAuthority(ctx, req interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, req}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateCertificateAuthority", reflect.TypeOf((*MockCertificateAuthorityClient)(nil).CreateCertificateAuthority), varargs...) +} + +// FetchCertificateAuthorityCsr mocks base method +func (m *MockCertificateAuthorityClient) FetchCertificateAuthorityCsr(ctx context.Context, req *privateca0.FetchCertificateAuthorityCsrRequest, opts ...gax.CallOption) (*privateca0.FetchCertificateAuthorityCsrResponse, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, req} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "FetchCertificateAuthorityCsr", varargs...) + ret0, _ := ret[0].(*privateca0.FetchCertificateAuthorityCsrResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// FetchCertificateAuthorityCsr indicates an expected call of FetchCertificateAuthorityCsr +func (mr *MockCertificateAuthorityClientMockRecorder) FetchCertificateAuthorityCsr(ctx, req interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, req}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FetchCertificateAuthorityCsr", reflect.TypeOf((*MockCertificateAuthorityClient)(nil).FetchCertificateAuthorityCsr), varargs...) +} + +// ActivateCertificateAuthority mocks base method +func (m *MockCertificateAuthorityClient) ActivateCertificateAuthority(ctx context.Context, req *privateca0.ActivateCertificateAuthorityRequest, opts ...gax.CallOption) (*privateca.ActivateCertificateAuthorityOperation, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, req} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ActivateCertificateAuthority", varargs...) + ret0, _ := ret[0].(*privateca.ActivateCertificateAuthorityOperation) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ActivateCertificateAuthority indicates an expected call of ActivateCertificateAuthority +func (mr *MockCertificateAuthorityClientMockRecorder) ActivateCertificateAuthority(ctx, req interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, req}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ActivateCertificateAuthority", reflect.TypeOf((*MockCertificateAuthorityClient)(nil).ActivateCertificateAuthority), varargs...) +} diff --git a/cas/cloudcas/mock_operation_server_test.go b/cas/cloudcas/mock_operation_server_test.go new file mode 100644 index 00000000..48564cd1 --- /dev/null +++ b/cas/cloudcas/mock_operation_server_test.go @@ -0,0 +1,270 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: /Users/mariano/go/pkg/mod/google.golang.org/genproto@v0.0.0-20200904004341-0bd0a958aa1d/googleapis/longrunning/operations.pb.go + +// Package cloudcas is a generated GoMock package. +package cloudcas + +import ( + context "context" + gomock "github.com/golang/mock/gomock" + longrunning "google.golang.org/genproto/googleapis/longrunning" + grpc "google.golang.org/grpc" + emptypb "google.golang.org/protobuf/types/known/emptypb" + reflect "reflect" +) + +// MockisOperation_Result is a mock of isOperation_Result interface +type MockisOperation_Result struct { + ctrl *gomock.Controller + recorder *MockisOperation_ResultMockRecorder +} + +// MockisOperation_ResultMockRecorder is the mock recorder for MockisOperation_Result +type MockisOperation_ResultMockRecorder struct { + mock *MockisOperation_Result +} + +// NewMockisOperation_Result creates a new mock instance +func NewMockisOperation_Result(ctrl *gomock.Controller) *MockisOperation_Result { + mock := &MockisOperation_Result{ctrl: ctrl} + mock.recorder = &MockisOperation_ResultMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use +func (m *MockisOperation_Result) EXPECT() *MockisOperation_ResultMockRecorder { + return m.recorder +} + +// isOperation_Result mocks base method +func (m *MockisOperation_Result) isOperation_Result() { + m.ctrl.T.Helper() + m.ctrl.Call(m, "isOperation_Result") +} + +// isOperation_Result indicates an expected call of isOperation_Result +func (mr *MockisOperation_ResultMockRecorder) isOperation_Result() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "isOperation_Result", reflect.TypeOf((*MockisOperation_Result)(nil).isOperation_Result)) +} + +// MockOperationsClient is a mock of OperationsClient interface +type MockOperationsClient struct { + ctrl *gomock.Controller + recorder *MockOperationsClientMockRecorder +} + +// MockOperationsClientMockRecorder is the mock recorder for MockOperationsClient +type MockOperationsClientMockRecorder struct { + mock *MockOperationsClient +} + +// NewMockOperationsClient creates a new mock instance +func NewMockOperationsClient(ctrl *gomock.Controller) *MockOperationsClient { + mock := &MockOperationsClient{ctrl: ctrl} + mock.recorder = &MockOperationsClientMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use +func (m *MockOperationsClient) EXPECT() *MockOperationsClientMockRecorder { + return m.recorder +} + +// ListOperations mocks base method +func (m *MockOperationsClient) ListOperations(ctx context.Context, in *longrunning.ListOperationsRequest, opts ...grpc.CallOption) (*longrunning.ListOperationsResponse, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, in} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "ListOperations", varargs...) + ret0, _ := ret[0].(*longrunning.ListOperationsResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListOperations indicates an expected call of ListOperations +func (mr *MockOperationsClientMockRecorder) ListOperations(ctx, in interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, in}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListOperations", reflect.TypeOf((*MockOperationsClient)(nil).ListOperations), varargs...) +} + +// GetOperation mocks base method +func (m *MockOperationsClient) GetOperation(ctx context.Context, in *longrunning.GetOperationRequest, opts ...grpc.CallOption) (*longrunning.Operation, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, in} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "GetOperation", varargs...) + ret0, _ := ret[0].(*longrunning.Operation) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetOperation indicates an expected call of GetOperation +func (mr *MockOperationsClientMockRecorder) GetOperation(ctx, in interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, in}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetOperation", reflect.TypeOf((*MockOperationsClient)(nil).GetOperation), varargs...) +} + +// DeleteOperation mocks base method +func (m *MockOperationsClient) DeleteOperation(ctx context.Context, in *longrunning.DeleteOperationRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, in} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "DeleteOperation", varargs...) + ret0, _ := ret[0].(*emptypb.Empty) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteOperation indicates an expected call of DeleteOperation +func (mr *MockOperationsClientMockRecorder) DeleteOperation(ctx, in interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, in}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteOperation", reflect.TypeOf((*MockOperationsClient)(nil).DeleteOperation), varargs...) +} + +// CancelOperation mocks base method +func (m *MockOperationsClient) CancelOperation(ctx context.Context, in *longrunning.CancelOperationRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, in} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "CancelOperation", varargs...) + ret0, _ := ret[0].(*emptypb.Empty) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CancelOperation indicates an expected call of CancelOperation +func (mr *MockOperationsClientMockRecorder) CancelOperation(ctx, in interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, in}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CancelOperation", reflect.TypeOf((*MockOperationsClient)(nil).CancelOperation), varargs...) +} + +// WaitOperation mocks base method +func (m *MockOperationsClient) WaitOperation(ctx context.Context, in *longrunning.WaitOperationRequest, opts ...grpc.CallOption) (*longrunning.Operation, error) { + m.ctrl.T.Helper() + varargs := []interface{}{ctx, in} + for _, a := range opts { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "WaitOperation", varargs...) + ret0, _ := ret[0].(*longrunning.Operation) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// WaitOperation indicates an expected call of WaitOperation +func (mr *MockOperationsClientMockRecorder) WaitOperation(ctx, in interface{}, opts ...interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]interface{}{ctx, in}, opts...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WaitOperation", reflect.TypeOf((*MockOperationsClient)(nil).WaitOperation), varargs...) +} + +// MockOperationsServer is a mock of OperationsServer interface +type MockOperationsServer struct { + ctrl *gomock.Controller + recorder *MockOperationsServerMockRecorder +} + +// MockOperationsServerMockRecorder is the mock recorder for MockOperationsServer +type MockOperationsServerMockRecorder struct { + mock *MockOperationsServer +} + +// NewMockOperationsServer creates a new mock instance +func NewMockOperationsServer(ctrl *gomock.Controller) *MockOperationsServer { + mock := &MockOperationsServer{ctrl: ctrl} + mock.recorder = &MockOperationsServerMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use +func (m *MockOperationsServer) EXPECT() *MockOperationsServerMockRecorder { + return m.recorder +} + +// ListOperations mocks base method +func (m *MockOperationsServer) ListOperations(arg0 context.Context, arg1 *longrunning.ListOperationsRequest) (*longrunning.ListOperationsResponse, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ListOperations", arg0, arg1) + ret0, _ := ret[0].(*longrunning.ListOperationsResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ListOperations indicates an expected call of ListOperations +func (mr *MockOperationsServerMockRecorder) ListOperations(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ListOperations", reflect.TypeOf((*MockOperationsServer)(nil).ListOperations), arg0, arg1) +} + +// GetOperation mocks base method +func (m *MockOperationsServer) GetOperation(arg0 context.Context, arg1 *longrunning.GetOperationRequest) (*longrunning.Operation, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetOperation", arg0, arg1) + ret0, _ := ret[0].(*longrunning.Operation) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetOperation indicates an expected call of GetOperation +func (mr *MockOperationsServerMockRecorder) GetOperation(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetOperation", reflect.TypeOf((*MockOperationsServer)(nil).GetOperation), arg0, arg1) +} + +// DeleteOperation mocks base method +func (m *MockOperationsServer) DeleteOperation(arg0 context.Context, arg1 *longrunning.DeleteOperationRequest) (*emptypb.Empty, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "DeleteOperation", arg0, arg1) + ret0, _ := ret[0].(*emptypb.Empty) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// DeleteOperation indicates an expected call of DeleteOperation +func (mr *MockOperationsServerMockRecorder) DeleteOperation(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DeleteOperation", reflect.TypeOf((*MockOperationsServer)(nil).DeleteOperation), arg0, arg1) +} + +// CancelOperation mocks base method +func (m *MockOperationsServer) CancelOperation(arg0 context.Context, arg1 *longrunning.CancelOperationRequest) (*emptypb.Empty, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CancelOperation", arg0, arg1) + ret0, _ := ret[0].(*emptypb.Empty) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CancelOperation indicates an expected call of CancelOperation +func (mr *MockOperationsServerMockRecorder) CancelOperation(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CancelOperation", reflect.TypeOf((*MockOperationsServer)(nil).CancelOperation), arg0, arg1) +} + +// WaitOperation mocks base method +func (m *MockOperationsServer) WaitOperation(arg0 context.Context, arg1 *longrunning.WaitOperationRequest) (*longrunning.Operation, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "WaitOperation", arg0, arg1) + ret0, _ := ret[0].(*longrunning.Operation) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// WaitOperation indicates an expected call of WaitOperation +func (mr *MockOperationsServerMockRecorder) WaitOperation(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "WaitOperation", reflect.TypeOf((*MockOperationsServer)(nil).WaitOperation), arg0, arg1) +}