From 2421ea4b415c69f8c4c7844f5d082cee9db5844b Mon Sep 17 00:00:00 2001 From: nyagamunene Date: Mon, 2 Dec 2024 15:46:39 +0300 Subject: [PATCH] fix failing linter Signed-off-by: nyagamunene --- api/http/requests.go | 17 ------------- api/http/responses.go | 16 ------------ mocks/service.go | 58 ------------------------------------------- 3 files changed, 91 deletions(-) diff --git a/api/http/requests.go b/api/http/requests.go index a6c5b31..948b6e6 100644 --- a/api/http/requests.go +++ b/api/http/requests.go @@ -88,23 +88,6 @@ func (req ocspReq) validate() error { return nil } -type createCSRReq struct { - Metadata certs.CSRMetadata `json:"metadata"` - PrivateKey string `json:"private_key"` - privKey any -} - -func (req createCSRReq) validate() error { - if req.Metadata.CommonName == "" { - return errors.Wrap(certs.ErrMalformedEntity, ErrMissingCN) - } - - if len(req.PrivateKey) == 0 { - return errors.Wrap(certs.ErrMalformedEntity, ErrMissingPrivKey) - } - return nil -} - type IssueFromCSRReq struct { entityID string ttl string diff --git a/api/http/responses.go b/api/http/responses.go index ae401fc..a21db40 100644 --- a/api/http/responses.go +++ b/api/http/responses.go @@ -202,22 +202,6 @@ type fileDownloadRes struct { ContentType string } -type createCSRRes struct { - CSR string `json:"csr"` -} - -func (res createCSRRes) Code() int { - return http.StatusCreated -} - -func (res createCSRRes) Headers() map[string]string { - return map[string]string{} -} - -func (res createCSRRes) Empty() bool { - return false -} - type issueFromCSRRes struct { SerialNumber string `json:"serial_number"` Certificate string `json:"certificate,omitempty"` diff --git a/mocks/service.go b/mocks/service.go index e805c6e..61c8d66 100644 --- a/mocks/service.go +++ b/mocks/service.go @@ -28,64 +28,6 @@ func (_m *MockService) EXPECT() *MockService_Expecter { return &MockService_Expecter{mock: &_m.Mock} } -// CreateCSR provides a mock function with given fields: ctx, metadata, privKey -func (_m *MockService) CreateCSR(ctx context.Context, metadata certs.CSRMetadata, privKey interface{}) (certs.CSR, error) { - ret := _m.Called(ctx, metadata, privKey) - - if len(ret) == 0 { - panic("no return value specified for CreateCSR") - } - - var r0 certs.CSR - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, certs.CSRMetadata, interface{}) (certs.CSR, error)); ok { - return rf(ctx, metadata, privKey) - } - if rf, ok := ret.Get(0).(func(context.Context, certs.CSRMetadata, interface{}) certs.CSR); ok { - r0 = rf(ctx, metadata, privKey) - } else { - r0 = ret.Get(0).(certs.CSR) - } - - if rf, ok := ret.Get(1).(func(context.Context, certs.CSRMetadata, interface{}) error); ok { - r1 = rf(ctx, metadata, privKey) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockService_CreateCSR_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CreateCSR' -type MockService_CreateCSR_Call struct { - *mock.Call -} - -// CreateCSR is a helper method to define mock.On call -// - ctx context.Context -// - metadata certs.CSRMetadata -// - privKey interface{} -func (_e *MockService_Expecter) CreateCSR(ctx interface{}, metadata interface{}, privKey interface{}) *MockService_CreateCSR_Call { - return &MockService_CreateCSR_Call{Call: _e.mock.On("CreateCSR", ctx, metadata, privKey)} -} - -func (_c *MockService_CreateCSR_Call) Run(run func(ctx context.Context, metadata certs.CSRMetadata, privKey interface{})) *MockService_CreateCSR_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(certs.CSRMetadata), args[2].(interface{})) - }) - return _c -} - -func (_c *MockService_CreateCSR_Call) Return(_a0 certs.CSR, _a1 error) *MockService_CreateCSR_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockService_CreateCSR_Call) RunAndReturn(run func(context.Context, certs.CSRMetadata, interface{}) (certs.CSR, error)) *MockService_CreateCSR_Call { - _c.Call.Return(run) - return _c -} - // GenerateCRL provides a mock function with given fields: ctx, caType func (_m *MockService) GenerateCRL(ctx context.Context, caType certs.CertType) ([]byte, error) { ret := _m.Called(ctx, caType)