utils_mock

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: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LogsInterfaceMock

type LogsInterfaceMock struct {
	// DeleteLogsFunc mocks the DeleteLogs method.
	DeleteLogsFunc func(ctx context.Context, filter models.LogFilter, opts v2.LogsDeleteLogsOptions) error

	// FlushFunc mocks the Flush method.
	FlushFunc func(ctx context.Context, opts v2.LogsFlushOptions) error

	// GetLogsFunc mocks the GetLogs method.
	GetLogsFunc func(ctx context.Context, params models.GetLogsParams, opts v2.LogsGetLogsOptions) (*models.GetLogsResponse, error)

	// LogFunc mocks the Log method.
	LogFunc func(logs []models.LogEntry, opts v2.LogsLogOptions)

	// StartFunc mocks the Start method.
	StartFunc func(ctx context.Context, opts v2.LogsStartOptions)
	// contains filtered or unexported fields
}

LogsInterfaceMock is a mock implementation of v2.LogsInterface.

func TestSomethingThatUsesLogsInterface(t *testing.T) {

	// make and configure a mocked v2.LogsInterface
	mockedLogsInterface := &LogsInterfaceMock{
		DeleteLogsFunc: func(ctx context.Context, filter models.LogFilter, opts v2.LogsDeleteLogsOptions) error {
			panic("mock out the DeleteLogs method")
		},
		FlushFunc: func(ctx context.Context, opts v2.LogsFlushOptions) error {
			panic("mock out the Flush method")
		},
		GetLogsFunc: func(ctx context.Context, params models.GetLogsParams, opts v2.LogsGetLogsOptions) (*models.GetLogsResponse, error) {
			panic("mock out the GetLogs method")
		},
		LogFunc: func(logs []models.LogEntry, opts v2.LogsLogOptions)  {
			panic("mock out the Log method")
		},
		StartFunc: func(ctx context.Context, opts v2.LogsStartOptions)  {
			panic("mock out the Start method")
		},
	}

	// use mockedLogsInterface in code that requires v2.LogsInterface
	// and then make assertions.

}

func (*LogsInterfaceMock) DeleteLogs

func (mock *LogsInterfaceMock) DeleteLogs(ctx context.Context, filter models.LogFilter, opts v2.LogsDeleteLogsOptions) error

DeleteLogs calls DeleteLogsFunc.

func (*LogsInterfaceMock) DeleteLogsCalls

func (mock *LogsInterfaceMock) DeleteLogsCalls() []struct {
	Ctx    context.Context
	Filter models.LogFilter
	Opts   v2.LogsDeleteLogsOptions
}

DeleteLogsCalls gets all the calls that were made to DeleteLogs. Check the length with:

len(mockedLogsInterface.DeleteLogsCalls())

func (*LogsInterfaceMock) Flush

func (mock *LogsInterfaceMock) Flush(ctx context.Context, opts v2.LogsFlushOptions) error

Flush calls FlushFunc.

func (*LogsInterfaceMock) FlushCalls

func (mock *LogsInterfaceMock) FlushCalls() []struct {
	Ctx  context.Context
	Opts v2.LogsFlushOptions
}

FlushCalls gets all the calls that were made to Flush. Check the length with:

len(mockedLogsInterface.FlushCalls())

func (*LogsInterfaceMock) GetLogs

GetLogs calls GetLogsFunc.

func (*LogsInterfaceMock) GetLogsCalls

func (mock *LogsInterfaceMock) GetLogsCalls() []struct {
	Ctx    context.Context
	Params models.GetLogsParams
	Opts   v2.LogsGetLogsOptions
}

GetLogsCalls gets all the calls that were made to GetLogs. Check the length with:

len(mockedLogsInterface.GetLogsCalls())

func (*LogsInterfaceMock) Log

func (mock *LogsInterfaceMock) Log(logs []models.LogEntry, opts v2.LogsLogOptions)

Log calls LogFunc.

func (*LogsInterfaceMock) LogCalls

func (mock *LogsInterfaceMock) LogCalls() []struct {
	Logs []models.LogEntry
	Opts v2.LogsLogOptions
}

LogCalls gets all the calls that were made to Log. Check the length with:

len(mockedLogsInterface.LogCalls())

func (*LogsInterfaceMock) Start

func (mock *LogsInterfaceMock) Start(ctx context.Context, opts v2.LogsStartOptions)

Start calls StartFunc.

func (*LogsInterfaceMock) StartCalls

func (mock *LogsInterfaceMock) StartCalls() []struct {
	Ctx  context.Context
	Opts v2.LogsStartOptions
}

StartCalls gets all the calls that were made to Start. Check the length with:

len(mockedLogsInterface.StartCalls())

type ResourcesInterfaceMock

type ResourcesInterfaceMock struct {
	// CreateProjectResourcesFunc mocks the CreateProjectResources method.
	CreateProjectResourcesFunc func(ctx context.Context, project string, resources []*models.Resource, opts v2.ResourcesCreateProjectResourcesOptions) (string, error)

	// CreateResourceFunc mocks the CreateResource method.
	CreateResourceFunc func(ctx context.Context, resource []*models.Resource, scope v2.ResourceScope, opts v2.ResourcesCreateResourceOptions) (string, error)

	// CreateResourcesFunc mocks the CreateResources method.
	CreateResourcesFunc func(ctx context.Context, project string, stage string, service string, resources []*models.Resource, opts v2.ResourcesCreateResourcesOptions) (*models.EventContext, *models.Error)

	// DeleteResourceFunc mocks the DeleteResource method.
	DeleteResourceFunc func(ctx context.Context, scope v2.ResourceScope, opts v2.ResourcesDeleteResourceOptions) error

	// GetAllServiceResourcesFunc mocks the GetAllServiceResources method.
	GetAllServiceResourcesFunc func(ctx context.Context, project string, stage string, service string, opts v2.ResourcesGetAllServiceResourcesOptions) ([]*models.Resource, error)

	// GetAllStageResourcesFunc mocks the GetAllStageResources method.
	GetAllStageResourcesFunc func(ctx context.Context, project string, stage string, opts v2.ResourcesGetAllStageResourcesOptions) ([]*models.Resource, error)

	// GetResourceFunc mocks the GetResource method.
	GetResourceFunc func(ctx context.Context, scope v2.ResourceScope, opts v2.ResourcesGetResourceOptions) (*models.Resource, error)

	// UpdateProjectResourcesFunc mocks the UpdateProjectResources method.
	UpdateProjectResourcesFunc func(ctx context.Context, project string, resources []*models.Resource, opts v2.ResourcesUpdateProjectResourcesOptions) (string, error)

	// UpdateResourceFunc mocks the UpdateResource method.
	UpdateResourceFunc func(ctx context.Context, resource *models.Resource, scope v2.ResourceScope, opts v2.ResourcesUpdateResourceOptions) (string, error)

	// UpdateServiceResourcesFunc mocks the UpdateServiceResources method.
	UpdateServiceResourcesFunc func(ctx context.Context, project string, stage string, service string, resources []*models.Resource, opts v2.ResourcesUpdateServiceResourcesOptions) (string, error)
	// contains filtered or unexported fields
}

ResourcesInterfaceMock is a mock implementation of v2.ResourcesInterface.

func TestSomethingThatUsesResourcesInterface(t *testing.T) {

	// make and configure a mocked v2.ResourcesInterface
	mockedResourcesInterface := &ResourcesInterfaceMock{
		CreateProjectResourcesFunc: func(ctx context.Context, project string, resources []*models.Resource, opts v2.ResourcesCreateProjectResourcesOptions) (string, error) {
			panic("mock out the CreateProjectResources method")
		},
		CreateResourceFunc: func(ctx context.Context, resource []*models.Resource, scope v2.ResourceScope, opts v2.ResourcesCreateResourceOptions) (string, error) {
			panic("mock out the CreateResource method")
		},
		CreateResourcesFunc: func(ctx context.Context, project string, stage string, service string, resources []*models.Resource, opts v2.ResourcesCreateResourcesOptions) (*models.EventContext, *models.Error) {
			panic("mock out the CreateResources method")
		},
		DeleteResourceFunc: func(ctx context.Context, scope v2.ResourceScope, opts v2.ResourcesDeleteResourceOptions) error {
			panic("mock out the DeleteResource method")
		},
		GetAllServiceResourcesFunc: func(ctx context.Context, project string, stage string, service string, opts v2.ResourcesGetAllServiceResourcesOptions) ([]*models.Resource, error) {
			panic("mock out the GetAllServiceResources method")
		},
		GetAllStageResourcesFunc: func(ctx context.Context, project string, stage string, opts v2.ResourcesGetAllStageResourcesOptions) ([]*models.Resource, error) {
			panic("mock out the GetAllStageResources method")
		},
		GetResourceFunc: func(ctx context.Context, scope v2.ResourceScope, opts v2.ResourcesGetResourceOptions) (*models.Resource, error) {
			panic("mock out the GetResource method")
		},
		UpdateProjectResourcesFunc: func(ctx context.Context, project string, resources []*models.Resource, opts v2.ResourcesUpdateProjectResourcesOptions) (string, error) {
			panic("mock out the UpdateProjectResources method")
		},
		UpdateResourceFunc: func(ctx context.Context, resource *models.Resource, scope v2.ResourceScope, opts v2.ResourcesUpdateResourceOptions) (string, error) {
			panic("mock out the UpdateResource method")
		},
		UpdateServiceResourcesFunc: func(ctx context.Context, project string, stage string, service string, resources []*models.Resource, opts v2.ResourcesUpdateServiceResourcesOptions) (string, error) {
			panic("mock out the UpdateServiceResources method")
		},
	}

	// use mockedResourcesInterface in code that requires v2.ResourcesInterface
	// and then make assertions.

}

func (*ResourcesInterfaceMock) CreateProjectResources

func (mock *ResourcesInterfaceMock) CreateProjectResources(ctx context.Context, project string, resources []*models.Resource, opts v2.ResourcesCreateProjectResourcesOptions) (string, error)

CreateProjectResources calls CreateProjectResourcesFunc.

func (*ResourcesInterfaceMock) CreateProjectResourcesCalls

func (mock *ResourcesInterfaceMock) CreateProjectResourcesCalls() []struct {
	Ctx       context.Context
	Project   string
	Resources []*models.Resource
	Opts      v2.ResourcesCreateProjectResourcesOptions
}

CreateProjectResourcesCalls gets all the calls that were made to CreateProjectResources. Check the length with:

len(mockedResourcesInterface.CreateProjectResourcesCalls())

func (*ResourcesInterfaceMock) CreateResource

func (mock *ResourcesInterfaceMock) CreateResource(ctx context.Context, resource []*models.Resource, scope v2.ResourceScope, opts v2.ResourcesCreateResourceOptions) (string, error)

CreateResource calls CreateResourceFunc.

func (*ResourcesInterfaceMock) CreateResourceCalls

func (mock *ResourcesInterfaceMock) CreateResourceCalls() []struct {
	Ctx      context.Context
	Resource []*models.Resource
	Scope    v2.ResourceScope
	Opts     v2.ResourcesCreateResourceOptions
}

CreateResourceCalls gets all the calls that were made to CreateResource. Check the length with:

len(mockedResourcesInterface.CreateResourceCalls())

func (*ResourcesInterfaceMock) CreateResources

func (mock *ResourcesInterfaceMock) CreateResources(ctx context.Context, project string, stage string, service string, resources []*models.Resource, opts v2.ResourcesCreateResourcesOptions) (*models.EventContext, *models.Error)

CreateResources calls CreateResourcesFunc.

func (*ResourcesInterfaceMock) CreateResourcesCalls

func (mock *ResourcesInterfaceMock) CreateResourcesCalls() []struct {
	Ctx       context.Context
	Project   string
	Stage     string
	Service   string
	Resources []*models.Resource
	Opts      v2.ResourcesCreateResourcesOptions
}

CreateResourcesCalls gets all the calls that were made to CreateResources. Check the length with:

len(mockedResourcesInterface.CreateResourcesCalls())

func (*ResourcesInterfaceMock) DeleteResource

DeleteResource calls DeleteResourceFunc.

func (*ResourcesInterfaceMock) DeleteResourceCalls

func (mock *ResourcesInterfaceMock) DeleteResourceCalls() []struct {
	Ctx   context.Context
	Scope v2.ResourceScope
	Opts  v2.ResourcesDeleteResourceOptions
}

DeleteResourceCalls gets all the calls that were made to DeleteResource. Check the length with:

len(mockedResourcesInterface.DeleteResourceCalls())

func (*ResourcesInterfaceMock) GetAllServiceResources

func (mock *ResourcesInterfaceMock) GetAllServiceResources(ctx context.Context, project string, stage string, service string, opts v2.ResourcesGetAllServiceResourcesOptions) ([]*models.Resource, error)

GetAllServiceResources calls GetAllServiceResourcesFunc.

func (*ResourcesInterfaceMock) GetAllServiceResourcesCalls

func (mock *ResourcesInterfaceMock) GetAllServiceResourcesCalls() []struct {
	Ctx     context.Context
	Project string
	Stage   string
	Service string
	Opts    v2.ResourcesGetAllServiceResourcesOptions
}

GetAllServiceResourcesCalls gets all the calls that were made to GetAllServiceResources. Check the length with:

len(mockedResourcesInterface.GetAllServiceResourcesCalls())

func (*ResourcesInterfaceMock) GetAllStageResources

func (mock *ResourcesInterfaceMock) GetAllStageResources(ctx context.Context, project string, stage string, opts v2.ResourcesGetAllStageResourcesOptions) ([]*models.Resource, error)

GetAllStageResources calls GetAllStageResourcesFunc.

func (*ResourcesInterfaceMock) GetAllStageResourcesCalls

func (mock *ResourcesInterfaceMock) GetAllStageResourcesCalls() []struct {
	Ctx     context.Context
	Project string
	Stage   string
	Opts    v2.ResourcesGetAllStageResourcesOptions
}

GetAllStageResourcesCalls gets all the calls that were made to GetAllStageResources. Check the length with:

len(mockedResourcesInterface.GetAllStageResourcesCalls())

func (*ResourcesInterfaceMock) GetResource

GetResource calls GetResourceFunc.

func (*ResourcesInterfaceMock) GetResourceCalls

func (mock *ResourcesInterfaceMock) GetResourceCalls() []struct {
	Ctx   context.Context
	Scope v2.ResourceScope
	Opts  v2.ResourcesGetResourceOptions
}

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

len(mockedResourcesInterface.GetResourceCalls())

func (*ResourcesInterfaceMock) UpdateProjectResources

func (mock *ResourcesInterfaceMock) UpdateProjectResources(ctx context.Context, project string, resources []*models.Resource, opts v2.ResourcesUpdateProjectResourcesOptions) (string, error)

UpdateProjectResources calls UpdateProjectResourcesFunc.

func (*ResourcesInterfaceMock) UpdateProjectResourcesCalls

func (mock *ResourcesInterfaceMock) UpdateProjectResourcesCalls() []struct {
	Ctx       context.Context
	Project   string
	Resources []*models.Resource
	Opts      v2.ResourcesUpdateProjectResourcesOptions
}

UpdateProjectResourcesCalls gets all the calls that were made to UpdateProjectResources. Check the length with:

len(mockedResourcesInterface.UpdateProjectResourcesCalls())

func (*ResourcesInterfaceMock) UpdateResource

func (mock *ResourcesInterfaceMock) UpdateResource(ctx context.Context, resource *models.Resource, scope v2.ResourceScope, opts v2.ResourcesUpdateResourceOptions) (string, error)

UpdateResource calls UpdateResourceFunc.

func (*ResourcesInterfaceMock) UpdateResourceCalls

func (mock *ResourcesInterfaceMock) UpdateResourceCalls() []struct {
	Ctx      context.Context
	Resource *models.Resource
	Scope    v2.ResourceScope
	Opts     v2.ResourcesUpdateResourceOptions
}

UpdateResourceCalls gets all the calls that were made to UpdateResource. Check the length with:

len(mockedResourcesInterface.UpdateResourceCalls())

func (*ResourcesInterfaceMock) UpdateServiceResources

func (mock *ResourcesInterfaceMock) UpdateServiceResources(ctx context.Context, project string, stage string, service string, resources []*models.Resource, opts v2.ResourcesUpdateServiceResourcesOptions) (string, error)

UpdateServiceResources calls UpdateServiceResourcesFunc.

func (*ResourcesInterfaceMock) UpdateServiceResourcesCalls

func (mock *ResourcesInterfaceMock) UpdateServiceResourcesCalls() []struct {
	Ctx       context.Context
	Project   string
	Stage     string
	Service   string
	Resources []*models.Resource
	Opts      v2.ResourcesUpdateServiceResourcesOptions
}

UpdateServiceResourcesCalls gets all the calls that were made to UpdateServiceResources. Check the length with:

len(mockedResourcesInterface.UpdateServiceResourcesCalls())

type SecretsInterfaceMock

type SecretsInterfaceMock struct {
	// CreateSecretFunc mocks the CreateSecret method.
	CreateSecretFunc func(ctx context.Context, secret models.Secret, opts v2.SecretsCreateSecretOptions) error

	// DeleteSecretFunc mocks the DeleteSecret method.
	DeleteSecretFunc func(ctx context.Context, secretName string, secretScope string, opts v2.SecretsDeleteSecretOptions) error

	// GetSecretsFunc mocks the GetSecrets method.
	GetSecretsFunc func(ctx context.Context, opts v2.SecretsGetSecretsOptions) (*models.GetSecretsResponse, error)

	// UpdateSecretFunc mocks the UpdateSecret method.
	UpdateSecretFunc func(ctx context.Context, secret models.Secret, opts v2.SecretsUpdateSecretOptions) error
	// contains filtered or unexported fields
}

SecretsInterfaceMock is a mock implementation of v2.SecretsInterface.

func TestSomethingThatUsesSecretsInterface(t *testing.T) {

	// make and configure a mocked v2.SecretsInterface
	mockedSecretsInterface := &SecretsInterfaceMock{
		CreateSecretFunc: func(ctx context.Context, secret models.Secret, opts v2.SecretsCreateSecretOptions) error {
			panic("mock out the CreateSecret method")
		},
		DeleteSecretFunc: func(ctx context.Context, secretName string, secretScope string, opts v2.SecretsDeleteSecretOptions) error {
			panic("mock out the DeleteSecret method")
		},
		GetSecretsFunc: func(ctx context.Context, opts v2.SecretsGetSecretsOptions) (*models.GetSecretsResponse, error) {
			panic("mock out the GetSecrets method")
		},
		UpdateSecretFunc: func(ctx context.Context, secret models.Secret, opts v2.SecretsUpdateSecretOptions) error {
			panic("mock out the UpdateSecret method")
		},
	}

	// use mockedSecretsInterface in code that requires v2.SecretsInterface
	// and then make assertions.

}

func (*SecretsInterfaceMock) CreateSecret

func (mock *SecretsInterfaceMock) CreateSecret(ctx context.Context, secret models.Secret, opts v2.SecretsCreateSecretOptions) error

CreateSecret calls CreateSecretFunc.

func (*SecretsInterfaceMock) CreateSecretCalls

func (mock *SecretsInterfaceMock) CreateSecretCalls() []struct {
	Ctx    context.Context
	Secret models.Secret
	Opts   v2.SecretsCreateSecretOptions
}

CreateSecretCalls gets all the calls that were made to CreateSecret. Check the length with:

len(mockedSecretsInterface.CreateSecretCalls())

func (*SecretsInterfaceMock) DeleteSecret

func (mock *SecretsInterfaceMock) DeleteSecret(ctx context.Context, secretName string, secretScope string, opts v2.SecretsDeleteSecretOptions) error

DeleteSecret calls DeleteSecretFunc.

func (*SecretsInterfaceMock) DeleteSecretCalls

func (mock *SecretsInterfaceMock) DeleteSecretCalls() []struct {
	Ctx         context.Context
	SecretName  string
	SecretScope string
	Opts        v2.SecretsDeleteSecretOptions
}

DeleteSecretCalls gets all the calls that were made to DeleteSecret. Check the length with:

len(mockedSecretsInterface.DeleteSecretCalls())

func (*SecretsInterfaceMock) GetSecrets

GetSecrets calls GetSecretsFunc.

func (*SecretsInterfaceMock) GetSecretsCalls

func (mock *SecretsInterfaceMock) GetSecretsCalls() []struct {
	Ctx  context.Context
	Opts v2.SecretsGetSecretsOptions
}

GetSecretsCalls gets all the calls that were made to GetSecrets. Check the length with:

len(mockedSecretsInterface.GetSecretsCalls())

func (*SecretsInterfaceMock) UpdateSecret

func (mock *SecretsInterfaceMock) UpdateSecret(ctx context.Context, secret models.Secret, opts v2.SecretsUpdateSecretOptions) error

UpdateSecret calls UpdateSecretFunc.

func (*SecretsInterfaceMock) UpdateSecretCalls

func (mock *SecretsInterfaceMock) UpdateSecretCalls() []struct {
	Ctx    context.Context
	Secret models.Secret
	Opts   v2.SecretsUpdateSecretOptions
}

UpdateSecretCalls gets all the calls that were made to UpdateSecret. Check the length with:

len(mockedSecretsInterface.UpdateSecretCalls())

Jump to

Keyboard shortcuts

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