testutil

package
v0.0.0-...-7d4f5d4 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeRequest

func MakeRequest(method string, url string, body interface{}, r *gin.Engine) (*httptest.ResponseRecorder, []byte)

MakeRequest to an http endpoint

Types

type StorageMock

type StorageMock struct {
	mock.Mock
	// TODO: This needs to be migrated to testify/mock way
	GetMonitorByIDResult    *types.Monitor
	GetMonitorByIDError     error
	GetAllMonitorsResult    []types.Monitor
	GetAllMonitorsError     error
	GetTargetByIDResult     *types.Target
	GetTargetByIDError      error
	GetAllTargetsResult     []*types.Target
	GetAllTargetsError      error
	InsertMonitorError      error
	InsertTargetError       error
	UpdateTargetStatusError error
}

StorageMock is a mock for storage

func (*StorageMock) Free

func (m *StorageMock) Free()

Free resources

func (*StorageMock) GetAllMonitors

func (m *StorageMock) GetAllMonitors(pageSize int64, pageIndex int64, contains string) ([]types.Monitor, error)

GetAllMonitors returns mocked stuff

func (*StorageMock) GetAllTargets

func (m *StorageMock) GetAllTargets(pageSize int64, pageIndex int64, contains string) ([]*types.Target, error)

GetAllTargets returns mocked stuff

func (*StorageMock) GetMonitorByID

func (m *StorageMock) GetMonitorByID(id string) (*types.Monitor, error)

GetMonitorByID returns mocked stuff

func (*StorageMock) GetTargetByID

func (m *StorageMock) GetTargetByID(id string, includeChildren bool) (*types.Target, error)

GetTargetByID returns nothing

func (*StorageMock) Init

func (m *StorageMock) Init()

Init with nothing

func (*StorageMock) InsertMonitor

func (m *StorageMock) InsertMonitor(monitor *types.Monitor) (*types.Monitor, error)

InsertMonitor in the db

func (*StorageMock) InsertTarget

func (m *StorageMock) InsertTarget(target *types.Target) (*types.Target, error)

InsertTarget into the db.

func (*StorageMock) Login

func (m *StorageMock) Login(email string, password string) error

UpdateTarget with also a status update force flag.

func (*StorageMock) UpdateMonitor

func (m *StorageMock) UpdateMonitor(oldMonitor *types.Monitor, newMonitor *types.Monitor) (*types.Monitor, error)

UpdateMonitor with the modifyable fields.

func (*StorageMock) UpdateTarget

func (m *StorageMock) UpdateTarget(oldTarget *types.Target, newTarget *types.Target,
	forceStatusUpdate bool) (*types.Target, error)

UpdateTarget with also a status update force flag.

func (*StorageMock) UpdateTargetStatus

func (m *StorageMock) UpdateTargetStatus(target *types.Target, targetPatch *types.TargetPatch) (*types.Target, error)

UpdateTargetStatus with all modified fields

Jump to

Keyboard shortcuts

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