Add mockgen commands for cloudcas_test

This commit is contained in:
max furman 2022-11-07 13:09:07 -08:00
parent d4e81723ee
commit 8f7fae585c
No known key found for this signature in database
3 changed files with 31 additions and 30 deletions

View file

@ -1,3 +1,6 @@
//go:generate mockgen -package cloudcas -mock_names=CertificateAuthorityClient=MockCertificateAuthorityClient -destination mock_client_test.go github.com/smallstep/certificates/cas/cloudcas CertificateAuthorityClient
//go:generate mockgen -package cloudcas -mock_names=OperationsServer=MockOperationsServer -destination mock_operation_server_test.go cloud.google.com/go/longrunning/autogen/longrunningpb OperationsServer
package cloudcas package cloudcas
import ( import (

View file

@ -5,13 +5,12 @@
package cloudcas package cloudcas
import ( import (
context "context"
reflect "reflect"
privateca "cloud.google.com/go/security/privateca/apiv1" 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" gomock "github.com/golang/mock/gomock"
gax "github.com/googleapis/gax-go/v2" gax "github.com/googleapis/gax-go/v2"
privateca0 "google.golang.org/genproto/googleapis/cloud/security/privateca/v1" reflect "reflect"
) )
// MockCertificateAuthorityClient is a mock of CertificateAuthorityClient interface // MockCertificateAuthorityClient is a mock of CertificateAuthorityClient interface
@ -38,7 +37,7 @@ func (m *MockCertificateAuthorityClient) EXPECT() *MockCertificateAuthorityClien
} }
// ActivateCertificateAuthority mocks base method // ActivateCertificateAuthority mocks base method
func (m *MockCertificateAuthorityClient) ActivateCertificateAuthority(arg0 context.Context, arg1 *privateca0.ActivateCertificateAuthorityRequest, arg2 ...gax.CallOption) (*privateca.ActivateCertificateAuthorityOperation, error) { func (m *MockCertificateAuthorityClient) ActivateCertificateAuthority(arg0 context.Context, arg1 *privatecapb.ActivateCertificateAuthorityRequest, arg2 ...gax.CallOption) (*privateca.ActivateCertificateAuthorityOperation, error) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
varargs := []interface{}{arg0, arg1} varargs := []interface{}{arg0, arg1}
for _, a := range arg2 { for _, a := range arg2 {
@ -58,7 +57,7 @@ func (mr *MockCertificateAuthorityClientMockRecorder) ActivateCertificateAuthori
} }
// CreateCaPool mocks base method // CreateCaPool mocks base method
func (m *MockCertificateAuthorityClient) CreateCaPool(arg0 context.Context, arg1 *privateca0.CreateCaPoolRequest, arg2 ...gax.CallOption) (*privateca.CreateCaPoolOperation, error) { func (m *MockCertificateAuthorityClient) CreateCaPool(arg0 context.Context, arg1 *privatecapb.CreateCaPoolRequest, arg2 ...gax.CallOption) (*privateca.CreateCaPoolOperation, error) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
varargs := []interface{}{arg0, arg1} varargs := []interface{}{arg0, arg1}
for _, a := range arg2 { for _, a := range arg2 {
@ -78,14 +77,14 @@ func (mr *MockCertificateAuthorityClientMockRecorder) CreateCaPool(arg0, arg1 in
} }
// CreateCertificate mocks base method // CreateCertificate mocks base method
func (m *MockCertificateAuthorityClient) CreateCertificate(arg0 context.Context, arg1 *privateca0.CreateCertificateRequest, arg2 ...gax.CallOption) (*privateca0.Certificate, error) { func (m *MockCertificateAuthorityClient) CreateCertificate(arg0 context.Context, arg1 *privatecapb.CreateCertificateRequest, arg2 ...gax.CallOption) (*privatecapb.Certificate, error) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
varargs := []interface{}{arg0, arg1} varargs := []interface{}{arg0, arg1}
for _, a := range arg2 { for _, a := range arg2 {
varargs = append(varargs, a) varargs = append(varargs, a)
} }
ret := m.ctrl.Call(m, "CreateCertificate", varargs...) ret := m.ctrl.Call(m, "CreateCertificate", varargs...)
ret0, _ := ret[0].(*privateca0.Certificate) ret0, _ := ret[0].(*privatecapb.Certificate)
ret1, _ := ret[1].(error) ret1, _ := ret[1].(error)
return ret0, ret1 return ret0, ret1
} }
@ -98,7 +97,7 @@ func (mr *MockCertificateAuthorityClientMockRecorder) CreateCertificate(arg0, ar
} }
// CreateCertificateAuthority mocks base method // CreateCertificateAuthority mocks base method
func (m *MockCertificateAuthorityClient) CreateCertificateAuthority(arg0 context.Context, arg1 *privateca0.CreateCertificateAuthorityRequest, arg2 ...gax.CallOption) (*privateca.CreateCertificateAuthorityOperation, error) { func (m *MockCertificateAuthorityClient) CreateCertificateAuthority(arg0 context.Context, arg1 *privatecapb.CreateCertificateAuthorityRequest, arg2 ...gax.CallOption) (*privateca.CreateCertificateAuthorityOperation, error) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
varargs := []interface{}{arg0, arg1} varargs := []interface{}{arg0, arg1}
for _, a := range arg2 { for _, a := range arg2 {
@ -118,7 +117,7 @@ func (mr *MockCertificateAuthorityClientMockRecorder) CreateCertificateAuthority
} }
// EnableCertificateAuthority mocks base method // EnableCertificateAuthority mocks base method
func (m *MockCertificateAuthorityClient) EnableCertificateAuthority(arg0 context.Context, arg1 *privateca0.EnableCertificateAuthorityRequest, arg2 ...gax.CallOption) (*privateca.EnableCertificateAuthorityOperation, error) { func (m *MockCertificateAuthorityClient) EnableCertificateAuthority(arg0 context.Context, arg1 *privatecapb.EnableCertificateAuthorityRequest, arg2 ...gax.CallOption) (*privateca.EnableCertificateAuthorityOperation, error) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
varargs := []interface{}{arg0, arg1} varargs := []interface{}{arg0, arg1}
for _, a := range arg2 { for _, a := range arg2 {
@ -138,14 +137,14 @@ func (mr *MockCertificateAuthorityClientMockRecorder) EnableCertificateAuthority
} }
// FetchCertificateAuthorityCsr mocks base method // FetchCertificateAuthorityCsr mocks base method
func (m *MockCertificateAuthorityClient) FetchCertificateAuthorityCsr(arg0 context.Context, arg1 *privateca0.FetchCertificateAuthorityCsrRequest, arg2 ...gax.CallOption) (*privateca0.FetchCertificateAuthorityCsrResponse, error) { func (m *MockCertificateAuthorityClient) FetchCertificateAuthorityCsr(arg0 context.Context, arg1 *privatecapb.FetchCertificateAuthorityCsrRequest, arg2 ...gax.CallOption) (*privatecapb.FetchCertificateAuthorityCsrResponse, error) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
varargs := []interface{}{arg0, arg1} varargs := []interface{}{arg0, arg1}
for _, a := range arg2 { for _, a := range arg2 {
varargs = append(varargs, a) varargs = append(varargs, a)
} }
ret := m.ctrl.Call(m, "FetchCertificateAuthorityCsr", varargs...) ret := m.ctrl.Call(m, "FetchCertificateAuthorityCsr", varargs...)
ret0, _ := ret[0].(*privateca0.FetchCertificateAuthorityCsrResponse) ret0, _ := ret[0].(*privatecapb.FetchCertificateAuthorityCsrResponse)
ret1, _ := ret[1].(error) ret1, _ := ret[1].(error)
return ret0, ret1 return ret0, ret1
} }
@ -158,14 +157,14 @@ func (mr *MockCertificateAuthorityClientMockRecorder) FetchCertificateAuthorityC
} }
// GetCaPool mocks base method // GetCaPool mocks base method
func (m *MockCertificateAuthorityClient) GetCaPool(arg0 context.Context, arg1 *privateca0.GetCaPoolRequest, arg2 ...gax.CallOption) (*privateca0.CaPool, error) { func (m *MockCertificateAuthorityClient) GetCaPool(arg0 context.Context, arg1 *privatecapb.GetCaPoolRequest, arg2 ...gax.CallOption) (*privatecapb.CaPool, error) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
varargs := []interface{}{arg0, arg1} varargs := []interface{}{arg0, arg1}
for _, a := range arg2 { for _, a := range arg2 {
varargs = append(varargs, a) varargs = append(varargs, a)
} }
ret := m.ctrl.Call(m, "GetCaPool", varargs...) ret := m.ctrl.Call(m, "GetCaPool", varargs...)
ret0, _ := ret[0].(*privateca0.CaPool) ret0, _ := ret[0].(*privatecapb.CaPool)
ret1, _ := ret[1].(error) ret1, _ := ret[1].(error)
return ret0, ret1 return ret0, ret1
} }
@ -178,14 +177,14 @@ func (mr *MockCertificateAuthorityClientMockRecorder) GetCaPool(arg0, arg1 inter
} }
// GetCertificateAuthority mocks base method // GetCertificateAuthority mocks base method
func (m *MockCertificateAuthorityClient) GetCertificateAuthority(arg0 context.Context, arg1 *privateca0.GetCertificateAuthorityRequest, arg2 ...gax.CallOption) (*privateca0.CertificateAuthority, error) { func (m *MockCertificateAuthorityClient) GetCertificateAuthority(arg0 context.Context, arg1 *privatecapb.GetCertificateAuthorityRequest, arg2 ...gax.CallOption) (*privatecapb.CertificateAuthority, error) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
varargs := []interface{}{arg0, arg1} varargs := []interface{}{arg0, arg1}
for _, a := range arg2 { for _, a := range arg2 {
varargs = append(varargs, a) varargs = append(varargs, a)
} }
ret := m.ctrl.Call(m, "GetCertificateAuthority", varargs...) ret := m.ctrl.Call(m, "GetCertificateAuthority", varargs...)
ret0, _ := ret[0].(*privateca0.CertificateAuthority) ret0, _ := ret[0].(*privatecapb.CertificateAuthority)
ret1, _ := ret[1].(error) ret1, _ := ret[1].(error)
return ret0, ret1 return ret0, ret1
} }
@ -198,14 +197,14 @@ func (mr *MockCertificateAuthorityClientMockRecorder) GetCertificateAuthority(ar
} }
// RevokeCertificate mocks base method // RevokeCertificate mocks base method
func (m *MockCertificateAuthorityClient) RevokeCertificate(arg0 context.Context, arg1 *privateca0.RevokeCertificateRequest, arg2 ...gax.CallOption) (*privateca0.Certificate, error) { func (m *MockCertificateAuthorityClient) RevokeCertificate(arg0 context.Context, arg1 *privatecapb.RevokeCertificateRequest, arg2 ...gax.CallOption) (*privatecapb.Certificate, error) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
varargs := []interface{}{arg0, arg1} varargs := []interface{}{arg0, arg1}
for _, a := range arg2 { for _, a := range arg2 {
varargs = append(varargs, a) varargs = append(varargs, a)
} }
ret := m.ctrl.Call(m, "RevokeCertificate", varargs...) ret := m.ctrl.Call(m, "RevokeCertificate", varargs...)
ret0, _ := ret[0].(*privateca0.Certificate) ret0, _ := ret[0].(*privatecapb.Certificate)
ret1, _ := ret[1].(error) ret1, _ := ret[1].(error)
return ret0, ret1 return ret0, ret1
} }

View file

@ -1,16 +1,15 @@
// Code generated by MockGen. DO NOT EDIT. // Code generated by MockGen. DO NOT EDIT.
// Source: google.golang.org/genproto/googleapis/longrunning (interfaces: OperationsServer) // Source: cloud.google.com/go/longrunning/autogen/longrunningpb (interfaces: OperationsServer)
// Package cloudcas is a generated GoMock package. // Package cloudcas is a generated GoMock package.
package cloudcas package cloudcas
import ( import (
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
context "context" context "context"
reflect "reflect"
gomock "github.com/golang/mock/gomock" gomock "github.com/golang/mock/gomock"
longrunning "google.golang.org/genproto/googleapis/longrunning"
emptypb "google.golang.org/protobuf/types/known/emptypb" emptypb "google.golang.org/protobuf/types/known/emptypb"
reflect "reflect"
) )
// MockOperationsServer is a mock of OperationsServer interface // MockOperationsServer is a mock of OperationsServer interface
@ -37,7 +36,7 @@ func (m *MockOperationsServer) EXPECT() *MockOperationsServerMockRecorder {
} }
// CancelOperation mocks base method // CancelOperation mocks base method
func (m *MockOperationsServer) CancelOperation(arg0 context.Context, arg1 *longrunning.CancelOperationRequest) (*emptypb.Empty, error) { func (m *MockOperationsServer) CancelOperation(arg0 context.Context, arg1 *longrunningpb.CancelOperationRequest) (*emptypb.Empty, error) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "CancelOperation", arg0, arg1) ret := m.ctrl.Call(m, "CancelOperation", arg0, arg1)
ret0, _ := ret[0].(*emptypb.Empty) ret0, _ := ret[0].(*emptypb.Empty)
@ -52,7 +51,7 @@ func (mr *MockOperationsServerMockRecorder) CancelOperation(arg0, arg1 interface
} }
// DeleteOperation mocks base method // DeleteOperation mocks base method
func (m *MockOperationsServer) DeleteOperation(arg0 context.Context, arg1 *longrunning.DeleteOperationRequest) (*emptypb.Empty, error) { func (m *MockOperationsServer) DeleteOperation(arg0 context.Context, arg1 *longrunningpb.DeleteOperationRequest) (*emptypb.Empty, error) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "DeleteOperation", arg0, arg1) ret := m.ctrl.Call(m, "DeleteOperation", arg0, arg1)
ret0, _ := ret[0].(*emptypb.Empty) ret0, _ := ret[0].(*emptypb.Empty)
@ -67,10 +66,10 @@ func (mr *MockOperationsServerMockRecorder) DeleteOperation(arg0, arg1 interface
} }
// GetOperation mocks base method // GetOperation mocks base method
func (m *MockOperationsServer) GetOperation(arg0 context.Context, arg1 *longrunning.GetOperationRequest) (*longrunning.Operation, error) { func (m *MockOperationsServer) GetOperation(arg0 context.Context, arg1 *longrunningpb.GetOperationRequest) (*longrunningpb.Operation, error) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "GetOperation", arg0, arg1) ret := m.ctrl.Call(m, "GetOperation", arg0, arg1)
ret0, _ := ret[0].(*longrunning.Operation) ret0, _ := ret[0].(*longrunningpb.Operation)
ret1, _ := ret[1].(error) ret1, _ := ret[1].(error)
return ret0, ret1 return ret0, ret1
} }
@ -82,10 +81,10 @@ func (mr *MockOperationsServerMockRecorder) GetOperation(arg0, arg1 interface{})
} }
// ListOperations mocks base method // ListOperations mocks base method
func (m *MockOperationsServer) ListOperations(arg0 context.Context, arg1 *longrunning.ListOperationsRequest) (*longrunning.ListOperationsResponse, error) { func (m *MockOperationsServer) ListOperations(arg0 context.Context, arg1 *longrunningpb.ListOperationsRequest) (*longrunningpb.ListOperationsResponse, error) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "ListOperations", arg0, arg1) ret := m.ctrl.Call(m, "ListOperations", arg0, arg1)
ret0, _ := ret[0].(*longrunning.ListOperationsResponse) ret0, _ := ret[0].(*longrunningpb.ListOperationsResponse)
ret1, _ := ret[1].(error) ret1, _ := ret[1].(error)
return ret0, ret1 return ret0, ret1
} }
@ -97,10 +96,10 @@ func (mr *MockOperationsServerMockRecorder) ListOperations(arg0, arg1 interface{
} }
// WaitOperation mocks base method // WaitOperation mocks base method
func (m *MockOperationsServer) WaitOperation(arg0 context.Context, arg1 *longrunning.WaitOperationRequest) (*longrunning.Operation, error) { func (m *MockOperationsServer) WaitOperation(arg0 context.Context, arg1 *longrunningpb.WaitOperationRequest) (*longrunningpb.Operation, error) {
m.ctrl.T.Helper() m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "WaitOperation", arg0, arg1) ret := m.ctrl.Call(m, "WaitOperation", arg0, arg1)
ret0, _ := ret[0].(*longrunning.Operation) ret0, _ := ret[0].(*longrunningpb.Operation)
ret1, _ := ret[1].(error) ret1, _ := ret[1].(error)
return ret0, ret1 return ret0, ret1
} }