mocks

package
v1.31.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 23, 2026 License: MIT Imports: 7 Imported by: 2 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClienterMock

type ClienterMock struct {
	// CheckerFunc mocks the Checker method.
	CheckerFunc func(ctx context.Context, check *healthcheck.CheckState) error

	// CreateFileEventFunc mocks the CreateFileEvent method.
	CreateFileEventFunc func(ctx context.Context, event files.FileEvent, headers sdk.Headers) (*files.FileEvent, error)

	// DeleteFileFunc mocks the DeleteFile method.
	DeleteFileFunc func(ctx context.Context, filePath string, headers sdk.Headers) error

	// GetFileFunc mocks the GetFile method.
	GetFileFunc func(ctx context.Context, filePath string, headers sdk.Headers) (*files.StoredRegisteredMetaData, error)

	// HealthFunc mocks the Health method.
	HealthFunc func() *health.Client

	// MarkFilePublishedFunc mocks the MarkFilePublished method.
	MarkFilePublishedFunc func(ctx context.Context, filePath string, headers sdk.Headers) error

	// MarkFileUploadedFunc mocks the MarkFileUploaded method.
	MarkFileUploadedFunc func(ctx context.Context, filePath string, etag string, headers sdk.Headers) error

	// RegisterFileFunc mocks the RegisterFile method.
	RegisterFileFunc func(ctx context.Context, metadata files.StoredRegisteredMetaData, headers sdk.Headers) error

	// URLFunc mocks the URL method.
	URLFunc func() string

	// UpdateContentItemFunc mocks the UpdateContentItem method.
	UpdateContentItemFunc func(ctx context.Context, filePath string, item api.ContentItem, headers sdk.Headers) (*files.StoredRegisteredMetaData, error)
	// contains filtered or unexported fields
}

ClienterMock is a mock implementation of sdk.Clienter.

func TestSomethingThatUsesClienter(t *testing.T) {

	// make and configure a mocked sdk.Clienter
	mockedClienter := &ClienterMock{
		CheckerFunc: func(ctx context.Context, check *healthcheck.CheckState) error {
			panic("mock out the Checker method")
		},
		CreateFileEventFunc: func(ctx context.Context, event files.FileEvent, headers sdk.Headers) (*files.FileEvent, error) {
			panic("mock out the CreateFileEvent method")
		},
		DeleteFileFunc: func(ctx context.Context, filePath string, headers sdk.Headers) error {
			panic("mock out the DeleteFile method")
		},
		GetFileFunc: func(ctx context.Context, filePath string, headers sdk.Headers) (*files.StoredRegisteredMetaData, error) {
			panic("mock out the GetFile method")
		},
		HealthFunc: func() *health.Client {
			panic("mock out the Health method")
		},
		MarkFilePublishedFunc: func(ctx context.Context, filePath string, headers sdk.Headers) error {
			panic("mock out the MarkFilePublished method")
		},
		MarkFileUploadedFunc: func(ctx context.Context, filePath string, etag string, headers sdk.Headers) error {
			panic("mock out the MarkFileUploaded method")
		},
		RegisterFileFunc: func(ctx context.Context, metadata files.StoredRegisteredMetaData, headers sdk.Headers) error {
			panic("mock out the RegisterFile method")
		},
		URLFunc: func() string {
			panic("mock out the URL method")
		},
		UpdateContentItemFunc: func(ctx context.Context, filePath string, item api.ContentItem, headers sdk.Headers) (*files.StoredRegisteredMetaData, error) {
			panic("mock out the UpdateContentItem method")
		},
	}

	// use mockedClienter in code that requires sdk.Clienter
	// and then make assertions.

}

func (*ClienterMock) Checker

func (mock *ClienterMock) Checker(ctx context.Context, check *healthcheck.CheckState) error

Checker calls CheckerFunc.

func (*ClienterMock) CheckerCalls

func (mock *ClienterMock) CheckerCalls() []struct {
	Ctx   context.Context
	Check *healthcheck.CheckState
}

CheckerCalls gets all the calls that were made to Checker. Check the length with:

len(mockedClienter.CheckerCalls())

func (*ClienterMock) CreateFileEvent

func (mock *ClienterMock) CreateFileEvent(ctx context.Context, event files.FileEvent, headers sdk.Headers) (*files.FileEvent, error)

CreateFileEvent calls CreateFileEventFunc.

func (*ClienterMock) CreateFileEventCalls

func (mock *ClienterMock) CreateFileEventCalls() []struct {
	Ctx     context.Context
	Event   files.FileEvent
	Headers sdk.Headers
}

CreateFileEventCalls gets all the calls that were made to CreateFileEvent. Check the length with:

len(mockedClienter.CreateFileEventCalls())

func (*ClienterMock) DeleteFile

func (mock *ClienterMock) DeleteFile(ctx context.Context, filePath string, headers sdk.Headers) error

DeleteFile calls DeleteFileFunc.

func (*ClienterMock) DeleteFileCalls

func (mock *ClienterMock) DeleteFileCalls() []struct {
	Ctx      context.Context
	FilePath string
	Headers  sdk.Headers
}

DeleteFileCalls gets all the calls that were made to DeleteFile. Check the length with:

len(mockedClienter.DeleteFileCalls())

func (*ClienterMock) GetFile

func (mock *ClienterMock) GetFile(ctx context.Context, filePath string, headers sdk.Headers) (*files.StoredRegisteredMetaData, error)

GetFile calls GetFileFunc.

func (*ClienterMock) GetFileCalls

func (mock *ClienterMock) GetFileCalls() []struct {
	Ctx      context.Context
	FilePath string
	Headers  sdk.Headers
}

GetFileCalls gets all the calls that were made to GetFile. Check the length with:

len(mockedClienter.GetFileCalls())

func (*ClienterMock) Health

func (mock *ClienterMock) Health() *health.Client

Health calls HealthFunc.

func (*ClienterMock) HealthCalls

func (mock *ClienterMock) HealthCalls() []struct {
}

HealthCalls gets all the calls that were made to Health. Check the length with:

len(mockedClienter.HealthCalls())

func (*ClienterMock) MarkFilePublished

func (mock *ClienterMock) MarkFilePublished(ctx context.Context, filePath string, headers sdk.Headers) error

MarkFilePublished calls MarkFilePublishedFunc.

func (*ClienterMock) MarkFilePublishedCalls

func (mock *ClienterMock) MarkFilePublishedCalls() []struct {
	Ctx      context.Context
	FilePath string
	Headers  sdk.Headers
}

MarkFilePublishedCalls gets all the calls that were made to MarkFilePublished. Check the length with:

len(mockedClienter.MarkFilePublishedCalls())

func (*ClienterMock) MarkFileUploaded added in v1.17.0

func (mock *ClienterMock) MarkFileUploaded(ctx context.Context, filePath string, etag string, headers sdk.Headers) error

MarkFileUploaded calls MarkFileUploadedFunc.

func (*ClienterMock) MarkFileUploadedCalls added in v1.17.0

func (mock *ClienterMock) MarkFileUploadedCalls() []struct {
	Ctx      context.Context
	FilePath string
	Etag     string
	Headers  sdk.Headers
}

MarkFileUploadedCalls gets all the calls that were made to MarkFileUploaded. Check the length with:

len(mockedClienter.MarkFileUploadedCalls())

func (*ClienterMock) RegisterFile added in v1.17.0

func (mock *ClienterMock) RegisterFile(ctx context.Context, metadata files.StoredRegisteredMetaData, headers sdk.Headers) error

RegisterFile calls RegisterFileFunc.

func (*ClienterMock) RegisterFileCalls added in v1.17.0

func (mock *ClienterMock) RegisterFileCalls() []struct {
	Ctx      context.Context
	Metadata files.StoredRegisteredMetaData
	Headers  sdk.Headers
}

RegisterFileCalls gets all the calls that were made to RegisterFile. Check the length with:

len(mockedClienter.RegisterFileCalls())

func (*ClienterMock) URL

func (mock *ClienterMock) URL() string

URL calls URLFunc.

func (*ClienterMock) URLCalls

func (mock *ClienterMock) URLCalls() []struct {
}

URLCalls gets all the calls that were made to URL. Check the length with:

len(mockedClienter.URLCalls())

func (*ClienterMock) UpdateContentItem added in v1.22.0

func (mock *ClienterMock) UpdateContentItem(ctx context.Context, filePath string, item api.ContentItem, headers sdk.Headers) (*files.StoredRegisteredMetaData, error)

UpdateContentItem calls UpdateContentItemFunc.

func (*ClienterMock) UpdateContentItemCalls added in v1.22.0

func (mock *ClienterMock) UpdateContentItemCalls() []struct {
	Ctx      context.Context
	FilePath string
	Item     api.ContentItem
	Headers  sdk.Headers
}

UpdateContentItemCalls gets all the calls that were made to UpdateContentItem. Check the length with:

len(mockedClienter.UpdateContentItemCalls())

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL