mock

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AreaStoreMock

type AreaStoreMock struct {
	// CheckAreaExistsFunc mocks the CheckAreaExists method.
	CheckAreaExistsFunc func(id string) error

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

	// CloseFunc mocks the Close method.
	CloseFunc func(ctx context.Context) error

	// GetAreaFunc mocks the GetArea method.
	GetAreaFunc func(ctx context.Context, id string) (*models.Area, error)

	// GetAreasFunc mocks the GetAreas method.
	GetAreasFunc func(ctx context.Context, offset int, limit int) (*models.AreasResults, error)

	// GetVersionFunc mocks the GetVersion method.
	GetVersionFunc func(id string, versionID int) (*models.Area, error)
	// contains filtered or unexported fields
}

AreaStoreMock is a mock implementation of api.AreaStore.

    func TestSomethingThatUsesAreaStore(t *testing.T) {

        // make and configure a mocked api.AreaStore
        mockedAreaStore := &AreaStoreMock{
            CheckAreaExistsFunc: func(id string) error {
	               panic("mock out the CheckAreaExists method")
            },
            CheckerFunc: func(in1 context.Context, in2 *healthcheck.CheckState) error {
	               panic("mock out the Checker method")
            },
            CloseFunc: func(ctx context.Context) error {
	               panic("mock out the Close method")
            },
            GetAreaFunc: func(ctx context.Context, id string) (*models.Area, error) {
	               panic("mock out the GetArea method")
            },
            GetAreasFunc: func(ctx context.Context, offset int, limit int) (*models.AreasResults, error) {
	               panic("mock out the GetAreas method")
            },
            GetVersionFunc: func(id string, versionID int) (*models.Area, error) {
	               panic("mock out the GetVersion method")
            },
        }

        // use mockedAreaStore in code that requires api.AreaStore
        // and then make assertions.

    }

func (*AreaStoreMock) CheckAreaExists

func (mock *AreaStoreMock) CheckAreaExists(ctx context.Context, id string) error

CheckAreaExists calls CheckAreaExistsFunc.

func (*AreaStoreMock) CheckAreaExistsCalls

func (mock *AreaStoreMock) CheckAreaExistsCalls() []struct {
	ID string
}

CheckAreaExistsCalls gets all the calls that were made to CheckAreaExists. Check the length with:

len(mockedAreaStore.CheckAreaExistsCalls())

func (*AreaStoreMock) Checker

func (mock *AreaStoreMock) Checker(in1 context.Context, in2 *healthcheck.CheckState) error

Checker calls CheckerFunc.

func (*AreaStoreMock) CheckerCalls

func (mock *AreaStoreMock) CheckerCalls() []struct {
	In1 context.Context
	In2 *healthcheck.CheckState
}

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

len(mockedAreaStore.CheckerCalls())

func (*AreaStoreMock) Close

func (mock *AreaStoreMock) Close(ctx context.Context) error

Close calls CloseFunc.

func (*AreaStoreMock) CloseCalls

func (mock *AreaStoreMock) CloseCalls() []struct {
	Ctx context.Context
}

CloseCalls gets all the calls that were made to Close. Check the length with:

len(mockedAreaStore.CloseCalls())

func (*AreaStoreMock) GetArea

func (mock *AreaStoreMock) GetArea(ctx context.Context, id string) (*models.Area, error)

GetArea calls GetAreaFunc.

func (*AreaStoreMock) GetAreaCalls

func (mock *AreaStoreMock) GetAreaCalls() []struct {
	Ctx context.Context
	ID  string
}

GetAreaCalls gets all the calls that were made to GetArea. Check the length with:

len(mockedAreaStore.GetAreaCalls())

func (*AreaStoreMock) GetAreas

func (mock *AreaStoreMock) GetAreas(ctx context.Context, offset int, limit int) (*models.AreasResults, error)

GetAreas calls GetAreasFunc.

func (*AreaStoreMock) GetAreasCalls

func (mock *AreaStoreMock) GetAreasCalls() []struct {
	Ctx    context.Context
	Offset int
	Limit  int
}

GetAreasCalls gets all the calls that were made to GetAreas. Check the length with:

len(mockedAreaStore.GetAreasCalls())

func (*AreaStoreMock) GetVersion

func (mock *AreaStoreMock) GetVersion(ctx context.Context, id string, versionID int) (*models.Area, error)

GetVersion calls GetVersionFunc.

func (*AreaStoreMock) GetVersionCalls

func (mock *AreaStoreMock) GetVersionCalls() []struct {
	ID        string
	VersionID int
}

GetVersionCalls gets all the calls that were made to GetVersion. Check the length with:

len(mockedAreaStore.GetVersionCalls())

Jump to

Keyboard shortcuts

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