event_handler_mock

package
v0.0.0-...-318a3d5 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 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 EventStoreMock

type EventStoreMock struct {
	// GetEventsFunc mocks the GetEvents method.
	GetEventsFunc func(filter *keptnapi.EventFilter) ([]*apimodels.KeptnContextExtendedCE, *apimodels.Error)
	// contains filtered or unexported fields
}

EventStoreMock is a mock implementation of event_handler.EventStore.

func TestSomethingThatUsesEventStore(t *testing.T) {

	// make and configure a mocked event_handler.EventStore
	mockedEventStore := &EventStoreMock{
		GetEventsFunc: func(filter *keptnapi.EventFilter) ([]*apimodels.KeptnContextExtendedCE, *apimodels.Error) {
			panic("mock out the GetEvents method")
		},
	}

	// use mockedEventStore in code that requires event_handler.EventStore
	// and then make assertions.

}

func (*EventStoreMock) GetEvents

GetEvents calls GetEventsFunc.

func (*EventStoreMock) GetEventsCalls

func (mock *EventStoreMock) GetEventsCalls() []struct {
	Filter *keptnapi.EventFilter
}

GetEventsCalls gets all the calls that were made to GetEvents. Check the length with:

len(mockedEventStore.GetEventsCalls())

type ResourceHandlerMock

type ResourceHandlerMock struct {
	// GetResourceFunc mocks the GetResource method.
	GetResourceFunc func(scope keptnapi.ResourceScope, options ...keptnapi.URIOption) (*apimodels.Resource, error)
	// contains filtered or unexported fields
}

ResourceHandlerMock is a mock implementation of event_handler.ResourceHandler.

func TestSomethingThatUsesResourceHandler(t *testing.T) {

	// make and configure a mocked event_handler.ResourceHandler
	mockedResourceHandler := &ResourceHandlerMock{
		GetResourceFunc: func(scope keptnapi.ResourceScope, options ...keptnapi.URIOption) (*apimodels.Resource, error) {
			panic("mock out the GetResource method")
		},
	}

	// use mockedResourceHandler in code that requires event_handler.ResourceHandler
	// and then make assertions.

}

func (*ResourceHandlerMock) GetResource

func (mock *ResourceHandlerMock) GetResource(scope keptnapi.ResourceScope, options ...keptnapi.URIOption) (*apimodels.Resource, error)

GetResource calls GetResourceFunc.

func (*ResourceHandlerMock) GetResourceCalls

func (mock *ResourceHandlerMock) GetResourceCalls() []struct {
	Scope   keptnapi.ResourceScope
	Options []keptnapi.URIOption
}

GetResourceCalls gets all the calls that were made to GetResource. Check the length with:

len(mockedResourceHandler.GetResourceCalls())

type ServiceHandlerMock

type ServiceHandlerMock struct {
	// GetServiceFunc mocks the GetService method.
	GetServiceFunc func(project string, stage string, service string) (*apimodels.Service, error)
	// contains filtered or unexported fields
}

ServiceHandlerMock is a mock implementation of event_handler.ServiceHandler.

func TestSomethingThatUsesServiceHandler(t *testing.T) {

	// make and configure a mocked event_handler.ServiceHandler
	mockedServiceHandler := &ServiceHandlerMock{
		GetServiceFunc: func(project string, stage string, service string) (*apimodels.Service, error) {
			panic("mock out the GetService method")
		},
	}

	// use mockedServiceHandler in code that requires event_handler.ServiceHandler
	// and then make assertions.

}

func (*ServiceHandlerMock) GetService

func (mock *ServiceHandlerMock) GetService(project string, stage string, service string) (*apimodels.Service, error)

GetService calls GetServiceFunc.

func (*ServiceHandlerMock) GetServiceCalls

func (mock *ServiceHandlerMock) GetServiceCalls() []struct {
	Project string
	Stage   string
	Service string
}

GetServiceCalls gets all the calls that were made to GetService. Check the length with:

len(mockedServiceHandler.GetServiceCalls())

Jump to

Keyboard shortcuts

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