API принимает 202 после durable staging и TX intent (job+outbox); отдельные relay и worker публикуют/обрабатывают задания с publisher confirm, lease, retry/backoff, DLQ и replay. Добавлены версии pipeline, варианты thumbnail/crop/optimized, presign в verified staging, status-aware sweeper и admission control.
426 lines
14 KiB
Go
426 lines
14 KiB
Go
// Code generated by mockery; DO NOT EDIT.
|
|
// github.com/vektra/mockery
|
|
// template: testify
|
|
|
|
package mocks
|
|
|
|
import (
|
|
"context"
|
|
"io"
|
|
"mtusi-messenger/internal/domain"
|
|
"mtusi-messenger/internal/service/attachment"
|
|
|
|
"github.com/google/uuid"
|
|
mock "github.com/stretchr/testify/mock"
|
|
)
|
|
|
|
// NewMockAttachmentService creates a new instance of MockAttachmentService. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
|
|
// The first argument is typically a *testing.T value.
|
|
func NewMockAttachmentService(t interface {
|
|
mock.TestingT
|
|
Cleanup(func())
|
|
}) *MockAttachmentService {
|
|
if helper, ok := t.(interface{ Helper() }); ok {
|
|
helper.Helper()
|
|
}
|
|
|
|
mock := &MockAttachmentService{}
|
|
mock.Mock.Test(t)
|
|
|
|
t.Cleanup(func() {
|
|
if helper, ok := t.(interface{ Helper() }); ok {
|
|
helper.Helper()
|
|
}
|
|
mock.AssertExpectations(t)
|
|
})
|
|
|
|
return mock
|
|
}
|
|
|
|
// MockAttachmentService is an autogenerated mock type for the AttachmentService type
|
|
type MockAttachmentService struct {
|
|
mock.Mock
|
|
}
|
|
|
|
type MockAttachmentService_Expecter struct {
|
|
mock *mock.Mock
|
|
}
|
|
|
|
func (_m *MockAttachmentService) EXPECT() *MockAttachmentService_Expecter {
|
|
return &MockAttachmentService_Expecter{mock: &_m.Mock}
|
|
}
|
|
|
|
// Complete provides a mock function for the type MockAttachmentService
|
|
func (_mock *MockAttachmentService) Complete(ctx context.Context, ownerID uuid.UUID, id uuid.UUID, sha256 string) (domain.Attachment, error) {
|
|
ret := _mock.Called(ctx, ownerID, id, sha256)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Complete")
|
|
}
|
|
|
|
var r0 domain.Attachment
|
|
var r1 error
|
|
if returnFunc, ok := ret.Get(0).(func(context.Context, uuid.UUID, uuid.UUID, string) (domain.Attachment, error)); ok {
|
|
return returnFunc(ctx, ownerID, id, sha256)
|
|
}
|
|
if returnFunc, ok := ret.Get(0).(func(context.Context, uuid.UUID, uuid.UUID, string) domain.Attachment); ok {
|
|
r0 = returnFunc(ctx, ownerID, id, sha256)
|
|
} else {
|
|
r0 = ret.Get(0).(domain.Attachment)
|
|
}
|
|
if returnFunc, ok := ret.Get(1).(func(context.Context, uuid.UUID, uuid.UUID, string) error); ok {
|
|
r1 = returnFunc(ctx, ownerID, id, sha256)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
return r0, r1
|
|
}
|
|
|
|
// MockAttachmentService_Complete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Complete'
|
|
type MockAttachmentService_Complete_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// Complete is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - ownerID uuid.UUID
|
|
// - id uuid.UUID
|
|
// - sha256 string
|
|
func (_e *MockAttachmentService_Expecter) Complete(ctx any, ownerID any, id any, sha256 any) *MockAttachmentService_Complete_Call {
|
|
return &MockAttachmentService_Complete_Call{Call: _e.mock.On("Complete", ctx, ownerID, id, sha256)}
|
|
}
|
|
|
|
func (_c *MockAttachmentService_Complete_Call) Run(run func(ctx context.Context, ownerID uuid.UUID, id uuid.UUID, sha256 string)) *MockAttachmentService_Complete_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
var arg0 context.Context
|
|
if args[0] != nil {
|
|
arg0 = args[0].(context.Context)
|
|
}
|
|
var arg1 uuid.UUID
|
|
if args[1] != nil {
|
|
arg1 = args[1].(uuid.UUID)
|
|
}
|
|
var arg2 uuid.UUID
|
|
if args[2] != nil {
|
|
arg2 = args[2].(uuid.UUID)
|
|
}
|
|
var arg3 string
|
|
if args[3] != nil {
|
|
arg3 = args[3].(string)
|
|
}
|
|
run(
|
|
arg0,
|
|
arg1,
|
|
arg2,
|
|
arg3,
|
|
)
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockAttachmentService_Complete_Call) Return(attachment domain.Attachment, err error) *MockAttachmentService_Complete_Call {
|
|
_c.Call.Return(attachment, err)
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockAttachmentService_Complete_Call) RunAndReturn(run func(ctx context.Context, ownerID uuid.UUID, id uuid.UUID, sha256 string) (domain.Attachment, error)) *MockAttachmentService_Complete_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// Get provides a mock function for the type MockAttachmentService
|
|
func (_mock *MockAttachmentService) Get(ctx context.Context, callerID uuid.UUID, id uuid.UUID) (domain.Attachment, error) {
|
|
ret := _mock.Called(ctx, callerID, id)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Get")
|
|
}
|
|
|
|
var r0 domain.Attachment
|
|
var r1 error
|
|
if returnFunc, ok := ret.Get(0).(func(context.Context, uuid.UUID, uuid.UUID) (domain.Attachment, error)); ok {
|
|
return returnFunc(ctx, callerID, id)
|
|
}
|
|
if returnFunc, ok := ret.Get(0).(func(context.Context, uuid.UUID, uuid.UUID) domain.Attachment); ok {
|
|
r0 = returnFunc(ctx, callerID, id)
|
|
} else {
|
|
r0 = ret.Get(0).(domain.Attachment)
|
|
}
|
|
if returnFunc, ok := ret.Get(1).(func(context.Context, uuid.UUID, uuid.UUID) error); ok {
|
|
r1 = returnFunc(ctx, callerID, id)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
return r0, r1
|
|
}
|
|
|
|
// MockAttachmentService_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get'
|
|
type MockAttachmentService_Get_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// Get is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - callerID uuid.UUID
|
|
// - id uuid.UUID
|
|
func (_e *MockAttachmentService_Expecter) Get(ctx any, callerID any, id any) *MockAttachmentService_Get_Call {
|
|
return &MockAttachmentService_Get_Call{Call: _e.mock.On("Get", ctx, callerID, id)}
|
|
}
|
|
|
|
func (_c *MockAttachmentService_Get_Call) Run(run func(ctx context.Context, callerID uuid.UUID, id uuid.UUID)) *MockAttachmentService_Get_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
var arg0 context.Context
|
|
if args[0] != nil {
|
|
arg0 = args[0].(context.Context)
|
|
}
|
|
var arg1 uuid.UUID
|
|
if args[1] != nil {
|
|
arg1 = args[1].(uuid.UUID)
|
|
}
|
|
var arg2 uuid.UUID
|
|
if args[2] != nil {
|
|
arg2 = args[2].(uuid.UUID)
|
|
}
|
|
run(
|
|
arg0,
|
|
arg1,
|
|
arg2,
|
|
)
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockAttachmentService_Get_Call) Return(attachment domain.Attachment, err error) *MockAttachmentService_Get_Call {
|
|
_c.Call.Return(attachment, err)
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockAttachmentService_Get_Call) RunAndReturn(run func(ctx context.Context, callerID uuid.UUID, id uuid.UUID) (domain.Attachment, error)) *MockAttachmentService_Get_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// OpenVariant provides a mock function for the type MockAttachmentService
|
|
func (_mock *MockAttachmentService) OpenVariant(ctx context.Context, callerID uuid.UUID, id uuid.UUID, name domain.VariantName) (domain.Attachment, domain.Variant, io.ReadCloser, error) {
|
|
ret := _mock.Called(ctx, callerID, id, name)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for OpenVariant")
|
|
}
|
|
|
|
var r0 domain.Attachment
|
|
var r1 domain.Variant
|
|
var r2 io.ReadCloser
|
|
var r3 error
|
|
if returnFunc, ok := ret.Get(0).(func(context.Context, uuid.UUID, uuid.UUID, domain.VariantName) (domain.Attachment, domain.Variant, io.ReadCloser, error)); ok {
|
|
return returnFunc(ctx, callerID, id, name)
|
|
}
|
|
if returnFunc, ok := ret.Get(0).(func(context.Context, uuid.UUID, uuid.UUID, domain.VariantName) domain.Attachment); ok {
|
|
r0 = returnFunc(ctx, callerID, id, name)
|
|
} else {
|
|
r0 = ret.Get(0).(domain.Attachment)
|
|
}
|
|
if returnFunc, ok := ret.Get(1).(func(context.Context, uuid.UUID, uuid.UUID, domain.VariantName) domain.Variant); ok {
|
|
r1 = returnFunc(ctx, callerID, id, name)
|
|
} else {
|
|
r1 = ret.Get(1).(domain.Variant)
|
|
}
|
|
if returnFunc, ok := ret.Get(2).(func(context.Context, uuid.UUID, uuid.UUID, domain.VariantName) io.ReadCloser); ok {
|
|
r2 = returnFunc(ctx, callerID, id, name)
|
|
} else {
|
|
if ret.Get(2) != nil {
|
|
r2 = ret.Get(2).(io.ReadCloser)
|
|
}
|
|
}
|
|
if returnFunc, ok := ret.Get(3).(func(context.Context, uuid.UUID, uuid.UUID, domain.VariantName) error); ok {
|
|
r3 = returnFunc(ctx, callerID, id, name)
|
|
} else {
|
|
r3 = ret.Error(3)
|
|
}
|
|
return r0, r1, r2, r3
|
|
}
|
|
|
|
// MockAttachmentService_OpenVariant_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'OpenVariant'
|
|
type MockAttachmentService_OpenVariant_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// OpenVariant is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - callerID uuid.UUID
|
|
// - id uuid.UUID
|
|
// - name domain.VariantName
|
|
func (_e *MockAttachmentService_Expecter) OpenVariant(ctx any, callerID any, id any, name any) *MockAttachmentService_OpenVariant_Call {
|
|
return &MockAttachmentService_OpenVariant_Call{Call: _e.mock.On("OpenVariant", ctx, callerID, id, name)}
|
|
}
|
|
|
|
func (_c *MockAttachmentService_OpenVariant_Call) Run(run func(ctx context.Context, callerID uuid.UUID, id uuid.UUID, name domain.VariantName)) *MockAttachmentService_OpenVariant_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
var arg0 context.Context
|
|
if args[0] != nil {
|
|
arg0 = args[0].(context.Context)
|
|
}
|
|
var arg1 uuid.UUID
|
|
if args[1] != nil {
|
|
arg1 = args[1].(uuid.UUID)
|
|
}
|
|
var arg2 uuid.UUID
|
|
if args[2] != nil {
|
|
arg2 = args[2].(uuid.UUID)
|
|
}
|
|
var arg3 domain.VariantName
|
|
if args[3] != nil {
|
|
arg3 = args[3].(domain.VariantName)
|
|
}
|
|
run(
|
|
arg0,
|
|
arg1,
|
|
arg2,
|
|
arg3,
|
|
)
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockAttachmentService_OpenVariant_Call) Return(attachment domain.Attachment, variant domain.Variant, readCloser io.ReadCloser, err error) *MockAttachmentService_OpenVariant_Call {
|
|
_c.Call.Return(attachment, variant, readCloser, err)
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockAttachmentService_OpenVariant_Call) RunAndReturn(run func(ctx context.Context, callerID uuid.UUID, id uuid.UUID, name domain.VariantName) (domain.Attachment, domain.Variant, io.ReadCloser, error)) *MockAttachmentService_OpenVariant_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// Presign provides a mock function for the type MockAttachmentService
|
|
func (_mock *MockAttachmentService) Presign(ctx context.Context, request domain.PresignRequest) (domain.PresignResult, error) {
|
|
ret := _mock.Called(ctx, request)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Presign")
|
|
}
|
|
|
|
var r0 domain.PresignResult
|
|
var r1 error
|
|
if returnFunc, ok := ret.Get(0).(func(context.Context, domain.PresignRequest) (domain.PresignResult, error)); ok {
|
|
return returnFunc(ctx, request)
|
|
}
|
|
if returnFunc, ok := ret.Get(0).(func(context.Context, domain.PresignRequest) domain.PresignResult); ok {
|
|
r0 = returnFunc(ctx, request)
|
|
} else {
|
|
r0 = ret.Get(0).(domain.PresignResult)
|
|
}
|
|
if returnFunc, ok := ret.Get(1).(func(context.Context, domain.PresignRequest) error); ok {
|
|
r1 = returnFunc(ctx, request)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
return r0, r1
|
|
}
|
|
|
|
// MockAttachmentService_Presign_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Presign'
|
|
type MockAttachmentService_Presign_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// Presign is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - request domain.PresignRequest
|
|
func (_e *MockAttachmentService_Expecter) Presign(ctx any, request any) *MockAttachmentService_Presign_Call {
|
|
return &MockAttachmentService_Presign_Call{Call: _e.mock.On("Presign", ctx, request)}
|
|
}
|
|
|
|
func (_c *MockAttachmentService_Presign_Call) Run(run func(ctx context.Context, request domain.PresignRequest)) *MockAttachmentService_Presign_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
var arg0 context.Context
|
|
if args[0] != nil {
|
|
arg0 = args[0].(context.Context)
|
|
}
|
|
var arg1 domain.PresignRequest
|
|
if args[1] != nil {
|
|
arg1 = args[1].(domain.PresignRequest)
|
|
}
|
|
run(
|
|
arg0,
|
|
arg1,
|
|
)
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockAttachmentService_Presign_Call) Return(presignResult domain.PresignResult, err error) *MockAttachmentService_Presign_Call {
|
|
_c.Call.Return(presignResult, err)
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockAttachmentService_Presign_Call) RunAndReturn(run func(ctx context.Context, request domain.PresignRequest) (domain.PresignResult, error)) *MockAttachmentService_Presign_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|
|
|
|
// Upload provides a mock function for the type MockAttachmentService
|
|
func (_mock *MockAttachmentService) Upload(ctx context.Context, input attachment.UploadInput) (domain.Attachment, error) {
|
|
ret := _mock.Called(ctx, input)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Upload")
|
|
}
|
|
|
|
var r0 domain.Attachment
|
|
var r1 error
|
|
if returnFunc, ok := ret.Get(0).(func(context.Context, attachment.UploadInput) (domain.Attachment, error)); ok {
|
|
return returnFunc(ctx, input)
|
|
}
|
|
if returnFunc, ok := ret.Get(0).(func(context.Context, attachment.UploadInput) domain.Attachment); ok {
|
|
r0 = returnFunc(ctx, input)
|
|
} else {
|
|
r0 = ret.Get(0).(domain.Attachment)
|
|
}
|
|
if returnFunc, ok := ret.Get(1).(func(context.Context, attachment.UploadInput) error); ok {
|
|
r1 = returnFunc(ctx, input)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
return r0, r1
|
|
}
|
|
|
|
// MockAttachmentService_Upload_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Upload'
|
|
type MockAttachmentService_Upload_Call struct {
|
|
*mock.Call
|
|
}
|
|
|
|
// Upload is a helper method to define mock.On call
|
|
// - ctx context.Context
|
|
// - input attachment.UploadInput
|
|
func (_e *MockAttachmentService_Expecter) Upload(ctx any, input any) *MockAttachmentService_Upload_Call {
|
|
return &MockAttachmentService_Upload_Call{Call: _e.mock.On("Upload", ctx, input)}
|
|
}
|
|
|
|
func (_c *MockAttachmentService_Upload_Call) Run(run func(ctx context.Context, input attachment.UploadInput)) *MockAttachmentService_Upload_Call {
|
|
_c.Call.Run(func(args mock.Arguments) {
|
|
var arg0 context.Context
|
|
if args[0] != nil {
|
|
arg0 = args[0].(context.Context)
|
|
}
|
|
var arg1 attachment.UploadInput
|
|
if args[1] != nil {
|
|
arg1 = args[1].(attachment.UploadInput)
|
|
}
|
|
run(
|
|
arg0,
|
|
arg1,
|
|
)
|
|
})
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockAttachmentService_Upload_Call) Return(attachment1 domain.Attachment, err error) *MockAttachmentService_Upload_Call {
|
|
_c.Call.Return(attachment1, err)
|
|
return _c
|
|
}
|
|
|
|
func (_c *MockAttachmentService_Upload_Call) RunAndReturn(run func(ctx context.Context, input attachment.UploadInput) (domain.Attachment, error)) *MockAttachmentService_Upload_Call {
|
|
_c.Call.Return(run)
|
|
return _c
|
|
}
|