filetest

package
v1.28.0 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type UploaderMock

type UploaderMock struct {
	// BucketNameFunc mocks the BucketName method.
	BucketNameFunc func() string

	// CheckerFunc mocks the Checker method.
	CheckerFunc func(ctx context.Context, state *healthcheck.CheckState) error

	// ConfigFunc mocks the Config method.
	ConfigFunc func() aws.Config

	// UploadFunc mocks the Upload method.
	UploadFunc func(ctx context.Context, input *s3.PutObjectInput, options ...func(*manager.Uploader)) (*manager.UploadOutput, error)
	// contains filtered or unexported fields
}

UploaderMock is a mock implementation of file.Uploader.

func TestSomethingThatUsesUploader(t *testing.T) {

	// make and configure a mocked file.Uploader
	mockedUploader := &UploaderMock{
		BucketNameFunc: func() string {
			panic("mock out the BucketName method")
		},
		CheckerFunc: func(ctx context.Context, state *healthcheck.CheckState) error {
			panic("mock out the Checker method")
		},
		ConfigFunc: func() aws.Config {
			panic("mock out the Config method")
		},
		UploadFunc: func(ctx context.Context, input *s3.PutObjectInput, options ...func(*manager.Uploader)) (*manager.UploadOutput, error) {
			panic("mock out the Upload method")
		},
	}

	// use mockedUploader in code that requires file.Uploader
	// and then make assertions.

}

func (*UploaderMock) BucketName

func (mock *UploaderMock) BucketName() string

BucketName calls BucketNameFunc.

func (*UploaderMock) BucketNameCalls

func (mock *UploaderMock) BucketNameCalls() []struct {
}

BucketNameCalls gets all the calls that were made to BucketName. Check the length with:

len(mockedUploader.BucketNameCalls())

func (*UploaderMock) Checker

func (mock *UploaderMock) Checker(ctx context.Context, state *healthcheck.CheckState) error

Checker calls CheckerFunc.

func (*UploaderMock) CheckerCalls

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

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

len(mockedUploader.CheckerCalls())

func (*UploaderMock) Config added in v1.28.0

func (mock *UploaderMock) Config() aws.Config

Config calls ConfigFunc.

func (*UploaderMock) ConfigCalls added in v1.28.0

func (mock *UploaderMock) ConfigCalls() []struct {
}

ConfigCalls gets all the calls that were made to Config. Check the length with:

len(mockedUploader.ConfigCalls())

func (*UploaderMock) Upload

func (mock *UploaderMock) Upload(ctx context.Context, input *s3.PutObjectInput, options ...func(*manager.Uploader)) (*manager.UploadOutput, error)

Upload calls UploadFunc.

func (*UploaderMock) UploadCalls

func (mock *UploaderMock) UploadCalls() []struct {
	Ctx     context.Context
	Input   *s3.PutObjectInput
	Options []func(*manager.Uploader)
}

UploadCalls gets all the calls that were made to Upload. Check the length with:

len(mockedUploader.UploadCalls())

type VaultClientMock

type VaultClientMock struct {
	// WriteKeyFunc mocks the WriteKey method.
	WriteKeyFunc func(path string, key string, value string) error
	// contains filtered or unexported fields
}

VaultClientMock is a mock implementation of file.VaultClient.

func TestSomethingThatUsesVaultClient(t *testing.T) {

	// make and configure a mocked file.VaultClient
	mockedVaultClient := &VaultClientMock{
		WriteKeyFunc: func(path string, key string, value string) error {
			panic("mock out the WriteKey method")
		},
	}

	// use mockedVaultClient in code that requires file.VaultClient
	// and then make assertions.

}

func (*VaultClientMock) WriteKey

func (mock *VaultClientMock) WriteKey(path string, key string, value string) error

WriteKey calls WriteKeyFunc.

func (*VaultClientMock) WriteKeyCalls

func (mock *VaultClientMock) WriteKeyCalls() []struct {
	Path  string
	Key   string
	Value string
}

WriteKeyCalls gets all the calls that were made to WriteKey. Check the length with:

len(mockedVaultClient.WriteKeyCalls())

Jump to

Keyboard shortcuts

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