Просмотр исходного кода

Run make generate with mockgen@v1.6.0

max furman 4 лет назад
Родитель
Сommit
e351bd90dc
2 измененных файлов с 42 добавлено и 40 удалено
  1. 25 24
      cas/cloudcas/mock_client_test.go
  2. 17 16
      cas/cloudcas/mock_operation_server_test.go

+ 25 - 24
cas/cloudcas/mock_client_test.go

@@ -5,38 +5,39 @@
 package cloudcas
 
 import (
+	context "context"
+	reflect "reflect"
+
 	privateca "cloud.google.com/go/security/privateca/apiv1"
 	privatecapb "cloud.google.com/go/security/privateca/apiv1/privatecapb"
-	context "context"
 	gomock "github.com/golang/mock/gomock"
 	gax "github.com/googleapis/gax-go/v2"
-	reflect "reflect"
 )
 
-// MockCertificateAuthorityClient is a mock of CertificateAuthorityClient interface
+// MockCertificateAuthorityClient is a mock of CertificateAuthorityClient interface.
 type MockCertificateAuthorityClient struct {
 	ctrl     *gomock.Controller
 	recorder *MockCertificateAuthorityClientMockRecorder
 }
 
-// MockCertificateAuthorityClientMockRecorder is the mock recorder for MockCertificateAuthorityClient
+// MockCertificateAuthorityClientMockRecorder is the mock recorder for MockCertificateAuthorityClient.
 type MockCertificateAuthorityClientMockRecorder struct {
 	mock *MockCertificateAuthorityClient
 }
 
-// NewMockCertificateAuthorityClient creates a new mock instance
+// 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
+// EXPECT returns an object that allows the caller to indicate expected use.
 func (m *MockCertificateAuthorityClient) EXPECT() *MockCertificateAuthorityClientMockRecorder {
 	return m.recorder
 }
 
-// ActivateCertificateAuthority mocks base method
+// ActivateCertificateAuthority mocks base method.
 func (m *MockCertificateAuthorityClient) ActivateCertificateAuthority(arg0 context.Context, arg1 *privatecapb.ActivateCertificateAuthorityRequest, arg2 ...gax.CallOption) (*privateca.ActivateCertificateAuthorityOperation, error) {
 	m.ctrl.T.Helper()
 	varargs := []interface{}{arg0, arg1}
@@ -49,14 +50,14 @@ func (m *MockCertificateAuthorityClient) ActivateCertificateAuthority(arg0 conte
 	return ret0, ret1
 }
 
-// ActivateCertificateAuthority indicates an expected call of ActivateCertificateAuthority
+// ActivateCertificateAuthority indicates an expected call of ActivateCertificateAuthority.
 func (mr *MockCertificateAuthorityClientMockRecorder) ActivateCertificateAuthority(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {
 	mr.mock.ctrl.T.Helper()
 	varargs := append([]interface{}{arg0, arg1}, arg2...)
 	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ActivateCertificateAuthority", reflect.TypeOf((*MockCertificateAuthorityClient)(nil).ActivateCertificateAuthority), varargs...)
 }
 
-// CreateCaPool mocks base method
+// CreateCaPool mocks base method.
 func (m *MockCertificateAuthorityClient) CreateCaPool(arg0 context.Context, arg1 *privatecapb.CreateCaPoolRequest, arg2 ...gax.CallOption) (*privateca.CreateCaPoolOperation, error) {
 	m.ctrl.T.Helper()
 	varargs := []interface{}{arg0, arg1}
@@ -69,14 +70,14 @@ func (m *MockCertificateAuthorityClient) CreateCaPool(arg0 context.Context, arg1
 	return ret0, ret1
 }
 
-// CreateCaPool indicates an expected call of CreateCaPool
+// CreateCaPool indicates an expected call of CreateCaPool.
 func (mr *MockCertificateAuthorityClientMockRecorder) CreateCaPool(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {
 	mr.mock.ctrl.T.Helper()
 	varargs := append([]interface{}{arg0, arg1}, arg2...)
 	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateCaPool", reflect.TypeOf((*MockCertificateAuthorityClient)(nil).CreateCaPool), varargs...)
 }
 
-// CreateCertificate mocks base method
+// CreateCertificate mocks base method.
 func (m *MockCertificateAuthorityClient) CreateCertificate(arg0 context.Context, arg1 *privatecapb.CreateCertificateRequest, arg2 ...gax.CallOption) (*privatecapb.Certificate, error) {
 	m.ctrl.T.Helper()
 	varargs := []interface{}{arg0, arg1}
@@ -89,14 +90,14 @@ func (m *MockCertificateAuthorityClient) CreateCertificate(arg0 context.Context,
 	return ret0, ret1
 }
 
-// CreateCertificate indicates an expected call of CreateCertificate
+// CreateCertificate indicates an expected call of CreateCertificate.
 func (mr *MockCertificateAuthorityClientMockRecorder) CreateCertificate(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {
 	mr.mock.ctrl.T.Helper()
 	varargs := append([]interface{}{arg0, arg1}, arg2...)
 	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateCertificate", reflect.TypeOf((*MockCertificateAuthorityClient)(nil).CreateCertificate), varargs...)
 }
 
-// CreateCertificateAuthority mocks base method
+// CreateCertificateAuthority mocks base method.
 func (m *MockCertificateAuthorityClient) CreateCertificateAuthority(arg0 context.Context, arg1 *privatecapb.CreateCertificateAuthorityRequest, arg2 ...gax.CallOption) (*privateca.CreateCertificateAuthorityOperation, error) {
 	m.ctrl.T.Helper()
 	varargs := []interface{}{arg0, arg1}
@@ -109,14 +110,14 @@ func (m *MockCertificateAuthorityClient) CreateCertificateAuthority(arg0 context
 	return ret0, ret1
 }
 
-// CreateCertificateAuthority indicates an expected call of CreateCertificateAuthority
+// CreateCertificateAuthority indicates an expected call of CreateCertificateAuthority.
 func (mr *MockCertificateAuthorityClientMockRecorder) CreateCertificateAuthority(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {
 	mr.mock.ctrl.T.Helper()
 	varargs := append([]interface{}{arg0, arg1}, arg2...)
 	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateCertificateAuthority", reflect.TypeOf((*MockCertificateAuthorityClient)(nil).CreateCertificateAuthority), varargs...)
 }
 
-// EnableCertificateAuthority mocks base method
+// EnableCertificateAuthority mocks base method.
 func (m *MockCertificateAuthorityClient) EnableCertificateAuthority(arg0 context.Context, arg1 *privatecapb.EnableCertificateAuthorityRequest, arg2 ...gax.CallOption) (*privateca.EnableCertificateAuthorityOperation, error) {
 	m.ctrl.T.Helper()
 	varargs := []interface{}{arg0, arg1}
@@ -129,14 +130,14 @@ func (m *MockCertificateAuthorityClient) EnableCertificateAuthority(arg0 context
 	return ret0, ret1
 }
 
-// EnableCertificateAuthority indicates an expected call of EnableCertificateAuthority
+// EnableCertificateAuthority indicates an expected call of EnableCertificateAuthority.
 func (mr *MockCertificateAuthorityClientMockRecorder) EnableCertificateAuthority(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {
 	mr.mock.ctrl.T.Helper()
 	varargs := append([]interface{}{arg0, arg1}, arg2...)
 	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "EnableCertificateAuthority", reflect.TypeOf((*MockCertificateAuthorityClient)(nil).EnableCertificateAuthority), varargs...)
 }
 
-// FetchCertificateAuthorityCsr mocks base method
+// FetchCertificateAuthorityCsr mocks base method.
 func (m *MockCertificateAuthorityClient) FetchCertificateAuthorityCsr(arg0 context.Context, arg1 *privatecapb.FetchCertificateAuthorityCsrRequest, arg2 ...gax.CallOption) (*privatecapb.FetchCertificateAuthorityCsrResponse, error) {
 	m.ctrl.T.Helper()
 	varargs := []interface{}{arg0, arg1}
@@ -149,14 +150,14 @@ func (m *MockCertificateAuthorityClient) FetchCertificateAuthorityCsr(arg0 conte
 	return ret0, ret1
 }
 
-// FetchCertificateAuthorityCsr indicates an expected call of FetchCertificateAuthorityCsr
+// FetchCertificateAuthorityCsr indicates an expected call of FetchCertificateAuthorityCsr.
 func (mr *MockCertificateAuthorityClientMockRecorder) FetchCertificateAuthorityCsr(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {
 	mr.mock.ctrl.T.Helper()
 	varargs := append([]interface{}{arg0, arg1}, arg2...)
 	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FetchCertificateAuthorityCsr", reflect.TypeOf((*MockCertificateAuthorityClient)(nil).FetchCertificateAuthorityCsr), varargs...)
 }
 
-// GetCaPool mocks base method
+// GetCaPool mocks base method.
 func (m *MockCertificateAuthorityClient) GetCaPool(arg0 context.Context, arg1 *privatecapb.GetCaPoolRequest, arg2 ...gax.CallOption) (*privatecapb.CaPool, error) {
 	m.ctrl.T.Helper()
 	varargs := []interface{}{arg0, arg1}
@@ -169,14 +170,14 @@ func (m *MockCertificateAuthorityClient) GetCaPool(arg0 context.Context, arg1 *p
 	return ret0, ret1
 }
 
-// GetCaPool indicates an expected call of GetCaPool
+// GetCaPool indicates an expected call of GetCaPool.
 func (mr *MockCertificateAuthorityClientMockRecorder) GetCaPool(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {
 	mr.mock.ctrl.T.Helper()
 	varargs := append([]interface{}{arg0, arg1}, arg2...)
 	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCaPool", reflect.TypeOf((*MockCertificateAuthorityClient)(nil).GetCaPool), varargs...)
 }
 
-// GetCertificateAuthority mocks base method
+// GetCertificateAuthority mocks base method.
 func (m *MockCertificateAuthorityClient) GetCertificateAuthority(arg0 context.Context, arg1 *privatecapb.GetCertificateAuthorityRequest, arg2 ...gax.CallOption) (*privatecapb.CertificateAuthority, error) {
 	m.ctrl.T.Helper()
 	varargs := []interface{}{arg0, arg1}
@@ -189,14 +190,14 @@ func (m *MockCertificateAuthorityClient) GetCertificateAuthority(arg0 context.Co
 	return ret0, ret1
 }
 
-// GetCertificateAuthority indicates an expected call of GetCertificateAuthority
+// GetCertificateAuthority indicates an expected call of GetCertificateAuthority.
 func (mr *MockCertificateAuthorityClientMockRecorder) GetCertificateAuthority(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {
 	mr.mock.ctrl.T.Helper()
 	varargs := append([]interface{}{arg0, arg1}, arg2...)
 	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetCertificateAuthority", reflect.TypeOf((*MockCertificateAuthorityClient)(nil).GetCertificateAuthority), varargs...)
 }
 
-// RevokeCertificate mocks base method
+// RevokeCertificate mocks base method.
 func (m *MockCertificateAuthorityClient) RevokeCertificate(arg0 context.Context, arg1 *privatecapb.RevokeCertificateRequest, arg2 ...gax.CallOption) (*privatecapb.Certificate, error) {
 	m.ctrl.T.Helper()
 	varargs := []interface{}{arg0, arg1}
@@ -209,7 +210,7 @@ func (m *MockCertificateAuthorityClient) RevokeCertificate(arg0 context.Context,
 	return ret0, ret1
 }
 
-// RevokeCertificate indicates an expected call of RevokeCertificate
+// RevokeCertificate indicates an expected call of RevokeCertificate.
 func (mr *MockCertificateAuthorityClientMockRecorder) RevokeCertificate(arg0, arg1 interface{}, arg2 ...interface{}) *gomock.Call {
 	mr.mock.ctrl.T.Helper()
 	varargs := append([]interface{}{arg0, arg1}, arg2...)

+ 17 - 16
cas/cloudcas/mock_operation_server_test.go

@@ -5,37 +5,38 @@
 package cloudcas
 
 import (
-	longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
 	context "context"
+	reflect "reflect"
+
+	longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
 	gomock "github.com/golang/mock/gomock"
 	emptypb "google.golang.org/protobuf/types/known/emptypb"
-	reflect "reflect"
 )
 
-// MockOperationsServer is a mock of OperationsServer interface
+// MockOperationsServer is a mock of OperationsServer interface.
 type MockOperationsServer struct {
 	ctrl     *gomock.Controller
 	recorder *MockOperationsServerMockRecorder
 }
 
-// MockOperationsServerMockRecorder is the mock recorder for MockOperationsServer
+// MockOperationsServerMockRecorder is the mock recorder for MockOperationsServer.
 type MockOperationsServerMockRecorder struct {
 	mock *MockOperationsServer
 }
 
-// NewMockOperationsServer creates a new mock instance
+// 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
+// EXPECT returns an object that allows the caller to indicate expected use.
 func (m *MockOperationsServer) EXPECT() *MockOperationsServerMockRecorder {
 	return m.recorder
 }
 
-// CancelOperation mocks base method
+// CancelOperation mocks base method.
 func (m *MockOperationsServer) CancelOperation(arg0 context.Context, arg1 *longrunningpb.CancelOperationRequest) (*emptypb.Empty, error) {
 	m.ctrl.T.Helper()
 	ret := m.ctrl.Call(m, "CancelOperation", arg0, arg1)
@@ -44,13 +45,13 @@ func (m *MockOperationsServer) CancelOperation(arg0 context.Context, arg1 *longr
 	return ret0, ret1
 }
 
-// CancelOperation indicates an expected call of CancelOperation
+// 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)
 }
 
-// DeleteOperation mocks base method
+// DeleteOperation mocks base method.
 func (m *MockOperationsServer) DeleteOperation(arg0 context.Context, arg1 *longrunningpb.DeleteOperationRequest) (*emptypb.Empty, error) {
 	m.ctrl.T.Helper()
 	ret := m.ctrl.Call(m, "DeleteOperation", arg0, arg1)
@@ -59,13 +60,13 @@ func (m *MockOperationsServer) DeleteOperation(arg0 context.Context, arg1 *longr
 	return ret0, ret1
 }
 
-// DeleteOperation indicates an expected call of DeleteOperation
+// 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)
 }
 
-// GetOperation mocks base method
+// GetOperation mocks base method.
 func (m *MockOperationsServer) GetOperation(arg0 context.Context, arg1 *longrunningpb.GetOperationRequest) (*longrunningpb.Operation, error) {
 	m.ctrl.T.Helper()
 	ret := m.ctrl.Call(m, "GetOperation", arg0, arg1)
@@ -74,13 +75,13 @@ func (m *MockOperationsServer) GetOperation(arg0 context.Context, arg1 *longrunn
 	return ret0, ret1
 }
 
-// GetOperation indicates an expected call of GetOperation
+// 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)
 }
 
-// ListOperations mocks base method
+// ListOperations mocks base method.
 func (m *MockOperationsServer) ListOperations(arg0 context.Context, arg1 *longrunningpb.ListOperationsRequest) (*longrunningpb.ListOperationsResponse, error) {
 	m.ctrl.T.Helper()
 	ret := m.ctrl.Call(m, "ListOperations", arg0, arg1)
@@ -89,13 +90,13 @@ func (m *MockOperationsServer) ListOperations(arg0 context.Context, arg1 *longru
 	return ret0, ret1
 }
 
-// ListOperations indicates an expected call of ListOperations
+// 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)
 }
 
-// WaitOperation mocks base method
+// WaitOperation mocks base method.
 func (m *MockOperationsServer) WaitOperation(arg0 context.Context, arg1 *longrunningpb.WaitOperationRequest) (*longrunningpb.Operation, error) {
 	m.ctrl.T.Helper()
 	ret := m.ctrl.Call(m, "WaitOperation", arg0, arg1)
@@ -104,7 +105,7 @@ func (m *MockOperationsServer) WaitOperation(arg0 context.Context, arg1 *longrun
 	return ret0, ret1
 }
 
-// WaitOperation indicates an expected call of WaitOperation
+// 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)