mock_files

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FilesClienterMock

type FilesClienterMock struct {
	// GetFileFunc mocks the GetFile method.
	GetFileFunc func(ctx context.Context, path string, authToken string) (v2files.FileMetaData, error)

	// MarkFileUploadedFunc mocks the MarkFileUploaded method.
	MarkFileUploadedFunc func(ctx context.Context, path string, etag string) error

	// RegisterFileFunc mocks the RegisterFile method.
	RegisterFileFunc func(ctx context.Context, metadata v2files.FileMetaData) error
	// contains filtered or unexported fields
}

FilesClienterMock is a mock implementation of dpuploadservicefiles.FilesClienter.

func TestSomethingThatUsesFilesClienter(t *testing.T) {

	// make and configure a mocked dpuploadservicefiles.FilesClienter
	mockedFilesClienter := &FilesClienterMock{
		GetFileFunc: func(ctx context.Context, path string, authToken string) (v2files.FileMetaData, error) {
			panic("mock out the GetFile method")
		},
		MarkFileUploadedFunc: func(ctx context.Context, path string, etag string) error {
			panic("mock out the MarkFileUploaded method")
		},
		RegisterFileFunc: func(ctx context.Context, metadata v2files.FileMetaData) error {
			panic("mock out the RegisterFile method")
		},
	}

	// use mockedFilesClienter in code that requires dpuploadservicefiles.FilesClienter
	// and then make assertions.

}

func (*FilesClienterMock) GetFile

func (mock *FilesClienterMock) GetFile(ctx context.Context, path string, authToken string) (v2files.FileMetaData, error)

GetFile calls GetFileFunc.

func (*FilesClienterMock) GetFileCalls

func (mock *FilesClienterMock) GetFileCalls() []struct {
	Ctx       context.Context
	Path      string
	AuthToken string
}

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

len(mockedFilesClienter.GetFileCalls())

func (*FilesClienterMock) MarkFileUploaded

func (mock *FilesClienterMock) MarkFileUploaded(ctx context.Context, path string, etag string) error

MarkFileUploaded calls MarkFileUploadedFunc.

func (*FilesClienterMock) MarkFileUploadedCalls

func (mock *FilesClienterMock) MarkFileUploadedCalls() []struct {
	Ctx  context.Context
	Path string
	Etag string
}

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

len(mockedFilesClienter.MarkFileUploadedCalls())

func (*FilesClienterMock) RegisterFile

func (mock *FilesClienterMock) RegisterFile(ctx context.Context, metadata v2files.FileMetaData) error

RegisterFile calls RegisterFileFunc.

func (*FilesClienterMock) RegisterFileCalls

func (mock *FilesClienterMock) RegisterFileCalls() []struct {
	Ctx      context.Context
	Metadata v2files.FileMetaData
}

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

len(mockedFilesClienter.RegisterFileCalls())

Jump to

Keyboard shortcuts

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