fake

package
v0.0.20 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventAPIMock

type EventAPIMock struct {
	// GetFunc mocks the Get method.
	GetFunc func(eventFilter api.EventFilter) ([]*models.KeptnContextExtendedCE, error)

	// SendFunc mocks the Send method.
	SendFunc func(keptnContextExtendedCE models.KeptnContextExtendedCE) error
	// contains filtered or unexported fields
}

EventAPIMock is a mock implementation of http.EventAPI.

func TestSomethingThatUsesEventAPI(t *testing.T) {

	// make and configure a mocked http.EventAPI
	mockedEventAPI := &EventAPIMock{
		GetFunc: func(eventFilter api.EventFilter) ([]*models.KeptnContextExtendedCE, error) {
			panic("mock out the Get method")
		},
		SendFunc: func(keptnContextExtendedCE models.KeptnContextExtendedCE) error {
			panic("mock out the Send method")
		},
	}

	// use mockedEventAPI in code that requires http.EventAPI
	// and then make assertions.

}

func (*EventAPIMock) Get

func (mock *EventAPIMock) Get(eventFilter api.EventFilter) ([]*models.KeptnContextExtendedCE, error)

Get calls GetFunc.

func (*EventAPIMock) GetCalls

func (mock *EventAPIMock) GetCalls() []struct {
	EventFilter api.EventFilter
}

GetCalls gets all the calls that were made to Get. Check the length with:

len(mockedEventAPI.GetCalls())

func (*EventAPIMock) Send

func (mock *EventAPIMock) Send(keptnContextExtendedCE models.KeptnContextExtendedCE) error

Send calls SendFunc.

func (*EventAPIMock) SendCalls

func (mock *EventAPIMock) SendCalls() []struct {
	KeptnContextExtendedCE models.KeptnContextExtendedCE
}

SendCalls gets all the calls that were made to Send. Check the length with:

len(mockedEventAPI.SendCalls())

type GetEventAPIMock

type GetEventAPIMock struct {
	// GetOpenTriggeredEventsFunc mocks the GetOpenTriggeredEvents method.
	GetOpenTriggeredEventsFunc func(filter api.EventFilter) ([]*models.KeptnContextExtendedCE, error)
	// contains filtered or unexported fields
}

GetEventAPIMock is a mock implementation of http.GetEventAPI.

func TestSomethingThatUsesGetEventAPI(t *testing.T) {

	// make and configure a mocked http.GetEventAPI
	mockedGetEventAPI := &GetEventAPIMock{
		GetOpenTriggeredEventsFunc: func(filter api.EventFilter) ([]*models.KeptnContextExtendedCE, error) {
			panic("mock out the GetOpenTriggeredEvents method")
		},
	}

	// use mockedGetEventAPI in code that requires http.GetEventAPI
	// and then make assertions.

}

func (*GetEventAPIMock) GetOpenTriggeredEvents

func (mock *GetEventAPIMock) GetOpenTriggeredEvents(filter api.EventFilter) ([]*models.KeptnContextExtendedCE, error)

GetOpenTriggeredEvents calls GetOpenTriggeredEventsFunc.

func (*GetEventAPIMock) GetOpenTriggeredEventsCalls

func (mock *GetEventAPIMock) GetOpenTriggeredEventsCalls() []struct {
	Filter api.EventFilter
}

GetOpenTriggeredEventsCalls gets all the calls that were made to GetOpenTriggeredEvents. Check the length with:

len(mockedGetEventAPI.GetOpenTriggeredEventsCalls())

type SendEventAPIMock

type SendEventAPIMock struct {
	// SendEventFunc mocks the SendEvent method.
	SendEventFunc func(keptnContextExtendedCE models.KeptnContextExtendedCE) (*models.EventContext, *models.Error)
	// contains filtered or unexported fields
}

SendEventAPIMock is a mock implementation of http.SendEventAPI.

func TestSomethingThatUsesSendEventAPI(t *testing.T) {

	// make and configure a mocked http.SendEventAPI
	mockedSendEventAPI := &SendEventAPIMock{
		SendEventFunc: func(keptnContextExtendedCE models.KeptnContextExtendedCE) (*models.EventContext, *models.Error) {
			panic("mock out the SendEvent method")
		},
	}

	// use mockedSendEventAPI in code that requires http.SendEventAPI
	// and then make assertions.

}

func (*SendEventAPIMock) SendEvent

func (mock *SendEventAPIMock) SendEvent(keptnContextExtendedCE models.KeptnContextExtendedCE) (*models.EventContext, *models.Error)

SendEvent calls SendEventFunc.

func (*SendEventAPIMock) SendEventCalls

func (mock *SendEventAPIMock) SendEventCalls() []struct {
	KeptnContextExtendedCE models.KeptnContextExtendedCE
}

SendEventCalls gets all the calls that were made to SendEvent. Check the length with:

len(mockedSendEventAPI.SendEventCalls())

Jump to

Keyboard shortcuts

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