mocks

package
v1.19.0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 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 CompletedProducerMock

type CompletedProducerMock struct {
	// CompletedFunc mocks the Completed method.
	CompletedFunc func(ctx context.Context, e event.InstanceCompleted) error
	// contains filtered or unexported fields
}

CompletedProducerMock is a mock implementation of handler.CompletedProducer.

    func TestSomethingThatUsesCompletedProducer(t *testing.T) {

        // make and configure a mocked handler.CompletedProducer
        mockedCompletedProducer := &CompletedProducerMock{
            CompletedFunc: func(ctx context.Context, e event.InstanceCompleted) error {
	               panic("mock out the Completed method")
            },
        }

        // use mockedCompletedProducer in code that requires handler.CompletedProducer
        // and then make assertions.

    }

func (*CompletedProducerMock) Completed

Completed calls CompletedFunc.

func (*CompletedProducerMock) CompletedCalls

func (mock *CompletedProducerMock) CompletedCalls() []struct {
	Ctx context.Context
	E   event.InstanceCompleted
}

CompletedCalls gets all the calls that were made to Completed. Check the length with:

len(mockedCompletedProducer.CompletedCalls())

type IClientMock

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

	// GetInstanceFunc mocks the GetInstance method.
	GetInstanceFunc func(ctx context.Context, userAuthToken string, serviceAuthToken string, collectionID string, instanceID string, ifMatch string) (dataset.Instance, string, error)

	// GetInstanceDimensionsInBatchesFunc mocks the GetInstanceDimensionsInBatches method.
	GetInstanceDimensionsInBatchesFunc func(ctx context.Context, serviceAuthToken string, instanceID string, batchSize int, maxWorkers int) (dataset.Dimensions, string, error)

	// PatchInstanceDimensionsFunc mocks the PatchInstanceDimensions method.
	PatchInstanceDimensionsFunc func(ctx context.Context, serviceAuthToken string, instanceID string, upserts []*dataset.OptionPost, updates []*dataset.OptionUpdate, ifMatch string) (string, error)
	// contains filtered or unexported fields
}

IClientMock is a mock implementation of client.IClient.

    func TestSomethingThatUsesIClient(t *testing.T) {

        // make and configure a mocked client.IClient
        mockedIClient := &IClientMock{
            CheckerFunc: func(ctx context.Context, state *healthcheck.CheckState) error {
	               panic("mock out the Checker method")
            },
            GetInstanceFunc: func(ctx context.Context, userAuthToken string, serviceAuthToken string, collectionID string, instanceID string, ifMatch string) (dataset.Instance, string, error) {
	               panic("mock out the GetInstance method")
            },
            GetInstanceDimensionsInBatchesFunc: func(ctx context.Context, serviceAuthToken string, instanceID string, batchSize int, maxWorkers int) (dataset.Dimensions, string, error) {
	               panic("mock out the GetInstanceDimensionsInBatches method")
            },
            PatchInstanceDimensionsFunc: func(ctx context.Context, serviceAuthToken string, instanceID string, upserts []*dataset.OptionPost, updates []*dataset.OptionUpdate, ifMatch string) (string, error) {
	               panic("mock out the PatchInstanceDimensions method")
            },
        }

        // use mockedIClient in code that requires client.IClient
        // and then make assertions.

    }

func (*IClientMock) Checker

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

Checker calls CheckerFunc.

func (*IClientMock) CheckerCalls

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

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

len(mockedIClient.CheckerCalls())

func (*IClientMock) GetInstance

func (mock *IClientMock) GetInstance(ctx context.Context, userAuthToken string, serviceAuthToken string, collectionID string, instanceID string, ifMatch string) (dataset.Instance, string, error)

GetInstance calls GetInstanceFunc.

func (*IClientMock) GetInstanceCalls

func (mock *IClientMock) GetInstanceCalls() []struct {
	Ctx              context.Context
	UserAuthToken    string
	ServiceAuthToken string
	CollectionID     string
	InstanceID       string
	IfMatch          string
}

GetInstanceCalls gets all the calls that were made to GetInstance. Check the length with:

len(mockedIClient.GetInstanceCalls())

func (*IClientMock) GetInstanceDimensionsInBatches added in v1.10.0

func (mock *IClientMock) GetInstanceDimensionsInBatches(ctx context.Context, serviceAuthToken string, instanceID string, batchSize int, maxWorkers int) (dataset.Dimensions, string, error)

GetInstanceDimensionsInBatches calls GetInstanceDimensionsInBatchesFunc.

func (*IClientMock) GetInstanceDimensionsInBatchesCalls added in v1.10.0

func (mock *IClientMock) GetInstanceDimensionsInBatchesCalls() []struct {
	Ctx              context.Context
	ServiceAuthToken string
	InstanceID       string
	BatchSize        int
	MaxWorkers       int
}

GetInstanceDimensionsInBatchesCalls gets all the calls that were made to GetInstanceDimensionsInBatches. Check the length with:

len(mockedIClient.GetInstanceDimensionsInBatchesCalls())

func (*IClientMock) PatchInstanceDimensions added in v1.12.0

func (mock *IClientMock) PatchInstanceDimensions(ctx context.Context, serviceAuthToken string, instanceID string, upserts []*dataset.OptionPost, updates []*dataset.OptionUpdate, ifMatch string) (string, error)

PatchInstanceDimensions calls PatchInstanceDimensionsFunc.

func (*IClientMock) PatchInstanceDimensionsCalls added in v1.12.0

func (mock *IClientMock) PatchInstanceDimensionsCalls() []struct {
	Ctx              context.Context
	ServiceAuthToken string
	InstanceID       string
	Upserts          []*dataset.OptionPost
	Updates          []*dataset.OptionUpdate
	IfMatch          string
}

PatchInstanceDimensionsCalls gets all the calls that were made to PatchInstanceDimensions. Check the length with:

len(mockedIClient.PatchInstanceDimensionsCalls())

Jump to

Keyboard shortcuts

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