mocks

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2025 License: MIT Imports: 8 Imported by: 0

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 *health.CheckState) error

	// GetBundleFunc mocks the GetBundle method.
	GetBundleFunc func(ctx context.Context, headers sdk.Headers, id string) (*sdk.ResponseInfo, apiError.Error)

	// GetBundlesFunc mocks the GetBundles method.
	GetBundlesFunc func(ctx context.Context, headers sdk.Headers, scheduledAt *time.Time, queryParams *sdk.QueryParams) (*sdk.BundlesList, apiError.Error)

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

	// PutBundleStateFunc mocks the PutBundleState method.
	PutBundleStateFunc func(ctx context.Context, headers sdk.Headers, id string, state models.BundleState) (*models.Bundle, apiError.Error)

	// URLFunc mocks the URL method.
	URLFunc func() string
	// 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 *health.CheckState) error {
			panic("mock out the Checker method")
		},
		GetBundleFunc: func(ctx context.Context, headers sdk.Headers, id string) (*sdk.ResponseInfo, apiError.Error) {
			panic("mock out the GetBundle method")
		},
		GetBundlesFunc: func(ctx context.Context, headers sdk.Headers, scheduledAt *time.Time, queryParams *sdk.QueryParams) (*sdk.BundlesList, apiError.Error) {
			panic("mock out the GetBundles method")
		},
		HealthFunc: func() *healthcheck.Client {
			panic("mock out the Health method")
		},
		PutBundleStateFunc: func(ctx context.Context, headers sdk.Headers, id string, state models.BundleState) (*models.Bundle, apiError.Error) {
			panic("mock out the PutBundleState method")
		},
		URLFunc: func() string {
			panic("mock out the URL method")
		},
	}

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

}

func (*ClienterMock) Checker

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

Checker calls CheckerFunc.

func (*ClienterMock) CheckerCalls

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

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

len(mockedClienter.CheckerCalls())

func (*ClienterMock) GetBundle

func (mock *ClienterMock) GetBundle(ctx context.Context, headers sdk.Headers, id string) (*sdk.ResponseInfo, apiError.Error)

GetBundle calls GetBundleFunc.

func (*ClienterMock) GetBundleCalls

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

GetBundleCalls gets all the calls that were made to GetBundle. Check the length with:

len(mockedClienter.GetBundleCalls())

func (*ClienterMock) GetBundles

func (mock *ClienterMock) GetBundles(ctx context.Context, headers sdk.Headers, scheduledAt *time.Time, queryParams *sdk.QueryParams) (*sdk.BundlesList, apiError.Error)

GetBundles calls GetBundlesFunc.

func (*ClienterMock) GetBundlesCalls

func (mock *ClienterMock) GetBundlesCalls() []struct {
	Ctx         context.Context
	Headers     sdk.Headers
	ScheduledAt *time.Time
	QueryParams *sdk.QueryParams
}

GetBundlesCalls gets all the calls that were made to GetBundles. Check the length with:

len(mockedClienter.GetBundlesCalls())

func (*ClienterMock) Health

func (mock *ClienterMock) Health() *healthcheck.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) PutBundleState

func (mock *ClienterMock) PutBundleState(ctx context.Context, headers sdk.Headers, id string, state models.BundleState) (*models.Bundle, apiError.Error)

PutBundleState calls PutBundleStateFunc.

func (*ClienterMock) PutBundleStateCalls

func (mock *ClienterMock) PutBundleStateCalls() []struct {
	Ctx     context.Context
	Headers sdk.Headers
	ID      string
	State   models.BundleState
}

PutBundleStateCalls gets all the calls that were made to PutBundleState. Check the length with:

len(mockedClienter.PutBundleStateCalls())

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())

Jump to

Keyboard shortcuts

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