mocks

package
v1.62.0 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2024 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 AuthHandlerMock

type AuthHandlerMock struct {
	Required *PermissionCheckCalls
}

func NewAuthHandlerMock

func NewAuthHandlerMock() *AuthHandlerMock

func (AuthHandlerMock) Require

type CSVRowReaderMock

type CSVRowReaderMock struct {
	// CloseFunc mocks the Close method.
	CloseFunc func() error

	// ReadFunc mocks the Read method.
	ReadFunc func() (string, error)
	// contains filtered or unexported fields
}

CSVRowReaderMock is a mock implementation of CSVRowReader.

    func TestSomethingThatUsesCSVRowReader(t *testing.T) {

        // make and configure a mocked CSVRowReader
        mockedCSVRowReader := &CSVRowReaderMock{
            CloseFunc: func() error {
	               panic("TODO: mock out the Close method")
            },
            ReadFunc: func() (string, error) {
	               panic("TODO: mock out the Read method")
            },
        }

        // TODO: use mockedCSVRowReader in code that requires CSVRowReader
        //       and then make assertions.

    }

func (*CSVRowReaderMock) Close

func (mock *CSVRowReaderMock) Close() error

Close calls CloseFunc.

func (*CSVRowReaderMock) CloseCalls

func (mock *CSVRowReaderMock) CloseCalls() []struct {
}

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

len(mockedCSVRowReader.CloseCalls())

func (*CSVRowReaderMock) Read

func (mock *CSVRowReaderMock) Read() (string, error)

Read calls ReadFunc.

func (*CSVRowReaderMock) ReadCalls

func (mock *CSVRowReaderMock) ReadCalls() []struct {
}

ReadCalls gets all the calls that were made to Read. Check the length with:

len(mockedCSVRowReader.ReadCalls())

type CheckPermissionFunc

type CheckPermissionFunc func(handler http.HandlerFunc) http.HandlerFunc

type DownloadsGeneratorMock

type DownloadsGeneratorMock struct {
	// GenerateFunc mocks the Generate method.
	GenerateFunc func(ctx context.Context, datasetID string, instanceID string, edition string, version string) error
	// contains filtered or unexported fields
}

DownloadsGeneratorMock is a mock implementation of api.DownloadsGenerator.

func TestSomethingThatUsesDownloadsGenerator(t *testing.T) {

	// make and configure a mocked api.DownloadsGenerator
	mockedDownloadsGenerator := &DownloadsGeneratorMock{
		GenerateFunc: func(ctx context.Context, datasetID string, instanceID string, edition string, version string) error {
			panic("mock out the Generate method")
		},
	}

	// use mockedDownloadsGenerator in code that requires api.DownloadsGenerator
	// and then make assertions.

}

func (*DownloadsGeneratorMock) Generate

func (mock *DownloadsGeneratorMock) Generate(ctx context.Context, datasetID string, instanceID string, edition string, version string) error

Generate calls GenerateFunc.

func (*DownloadsGeneratorMock) GenerateCalls

func (mock *DownloadsGeneratorMock) GenerateCalls() []struct {
	Ctx        context.Context
	DatasetID  string
	InstanceID string
	Edition    string
	Version    string
}

GenerateCalls gets all the calls that were made to Generate. Check the length with:

len(mockedDownloadsGenerator.GenerateCalls())

type GenerateDownloadsEventMock

type GenerateDownloadsEventMock struct {
	// MarshalFunc mocks the Marshal method.
	MarshalFunc func(s interface{}) ([]byte, error)
	// contains filtered or unexported fields
}

GenerateDownloadsEventMock is a mock implementation of download.GenerateDownloadsEvent.

func TestSomethingThatUsesGenerateDownloadsEvent(t *testing.T) {

	// make and configure a mocked download.GenerateDownloadsEvent
	mockedGenerateDownloadsEvent := &GenerateDownloadsEventMock{
		MarshalFunc: func(s interface{}) ([]byte, error) {
			panic("mock out the Marshal method")
		},
	}

	// use mockedGenerateDownloadsEvent in code that requires download.GenerateDownloadsEvent
	// and then make assertions.

}

func (*GenerateDownloadsEventMock) Marshal

func (mock *GenerateDownloadsEventMock) Marshal(s interface{}) ([]byte, error)

Marshal calls MarshalFunc.

func (*GenerateDownloadsEventMock) MarshalCalls

func (mock *GenerateDownloadsEventMock) MarshalCalls() []struct {
	S interface{}
}

MarshalCalls gets all the calls that were made to Marshal. Check the length with:

len(mockedGenerateDownloadsEvent.MarshalCalls())

type KafkaProducerMock

type KafkaProducerMock struct {
	// OutputFunc mocks the Output method.
	OutputFunc func() chan kafka.BytesMessage
	// contains filtered or unexported fields
}

KafkaProducerMock is a mock implementation of download.KafkaProducer.

func TestSomethingThatUsesKafkaProducer(t *testing.T) {

	// make and configure a mocked download.KafkaProducer
	mockedKafkaProducer := &KafkaProducerMock{
		OutputFunc: func() chan []byte {
			panic("mock out the Output method")
		},
	}

	// use mockedKafkaProducer in code that requires download.KafkaProducer
	// and then make assertions.

}

func (*KafkaProducerMock) Output

func (mock *KafkaProducerMock) Output() chan kafka.BytesMessage

Output calls OutputFunc.

func (*KafkaProducerMock) OutputCalls

func (mock *KafkaProducerMock) OutputCalls() []struct {
}

OutputCalls gets all the calls that were made to Output. Check the length with:

len(mockedKafkaProducer.OutputCalls())

type PermissionCheckCalls

type PermissionCheckCalls struct {
	Calls int
}

Jump to

Keyboard shortcuts

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