testing

package
v5.10.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2019 License: MIT, MIT, MIT, + 1 more Imports: 5 Imported by: 16

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockClient

type MockClient struct {
	mock.Mock
}

MockClient uses mock package to allow your tests to easily mock out the results of any SensuClient operation.

func (*MockClient) AddCheckHook

func (c *MockClient) AddCheckHook(check *types.CheckConfig, checkHook *types.HookList) error

AddCheckHook for use with mock lib

func (*MockClient) AddGroupToUser

func (c *MockClient) AddGroupToUser(username, group string) error

AddGroupToUser for use with mock lib

func (*MockClient) CreateAccessToken

func (c *MockClient) CreateAccessToken(url, u, p string) (*types.Tokens, error)

CreateAccessToken for use with mock lib

func (*MockClient) CreateAsset

func (c *MockClient) CreateAsset(asset *types.Asset) error

CreateAsset for use with mock lib

func (*MockClient) CreateCheck

func (c *MockClient) CreateCheck(check *types.CheckConfig) error

CreateCheck for use with mock lib

func (*MockClient) CreateClusterRole

func (c *MockClient) CreateClusterRole(obj *types.ClusterRole) error

CreateClusterRole ...

func (*MockClient) CreateClusterRoleBinding

func (c *MockClient) CreateClusterRoleBinding(obj *types.ClusterRoleBinding) error

CreateClusterRoleBinding ...

func (*MockClient) CreateEntity

func (c *MockClient) CreateEntity(entity *types.Entity) error

CreateEntity for use with mock lib

func (*MockClient) CreateFilter

func (c *MockClient) CreateFilter(filter *types.EventFilter) error

CreateFilter for use with mock lib

func (*MockClient) CreateHandler

func (c *MockClient) CreateHandler(h *types.Handler) error

CreateHandler for use with mock package

func (*MockClient) CreateHook

func (c *MockClient) CreateHook(hook *types.HookConfig) error

CreateHook for use with mock lib

func (*MockClient) CreateMutator

func (c *MockClient) CreateMutator(m *types.Mutator) error

CreateMutator for use with mock package

func (*MockClient) CreateNamespace

func (c *MockClient) CreateNamespace(namespace *types.Namespace) error

CreateNamespace for use with mock lib

func (*MockClient) CreateRole

func (c *MockClient) CreateRole(check *types.Role) error

CreateRole ...

func (*MockClient) CreateRoleBinding

func (c *MockClient) CreateRoleBinding(obj *types.RoleBinding) error

CreateRoleBinding ...

func (*MockClient) CreateSilenced

func (c *MockClient) CreateSilenced(silenced *types.Silenced) error

CreateSilenced for use with mock lib

func (*MockClient) CreateUser

func (c *MockClient) CreateUser(user *types.User) error

CreateUser for use with mock lib

func (*MockClient) Delete

func (c *MockClient) Delete(path string) error

Delete ...

func (*MockClient) DeleteCheck

func (c *MockClient) DeleteCheck(namespace, name string) error

DeleteCheck for use with mock lib

func (*MockClient) DeleteClusterRole

func (c *MockClient) DeleteClusterRole(name string) error

DeleteClusterRole ...

func (*MockClient) DeleteClusterRoleBinding

func (c *MockClient) DeleteClusterRoleBinding(name string) error

DeleteClusterRoleBinding ...

func (*MockClient) DeleteEntity

func (c *MockClient) DeleteEntity(namespace, name string) error

DeleteEntity for use with mock lib

func (*MockClient) DeleteEvent

func (c *MockClient) DeleteEvent(namespace, entity, check string) error

DeleteEvent for use with mock lib

func (*MockClient) DeleteFilter

func (c *MockClient) DeleteFilter(namespace, name string) error

DeleteFilter for use with mock lib

func (*MockClient) DeleteHandler

func (c *MockClient) DeleteHandler(namespace, name string) error

DeleteHandler for use with mock package

func (*MockClient) DeleteHook

func (c *MockClient) DeleteHook(namespace, name string) error

DeleteHook for use with mock lib

func (*MockClient) DeleteMutator

func (c *MockClient) DeleteMutator(namespace, name string) error

DeleteMutator for use with mock package

func (*MockClient) DeleteNamespace

func (c *MockClient) DeleteNamespace(namespace string) error

DeleteNamespace for use with mock lib

func (*MockClient) DeleteRole

func (c *MockClient) DeleteRole(namespace, name string) error

DeleteRole ...

func (*MockClient) DeleteRoleBinding

func (c *MockClient) DeleteRoleBinding(namespace, name string) error

DeleteRoleBinding ...

func (*MockClient) DeleteSilenced

func (c *MockClient) DeleteSilenced(namespace, name string) error

DeleteSilenced for use with mock lib

func (*MockClient) DeregisterExtension

func (c *MockClient) DeregisterExtension(name, namespace string) error

DeregisterExtension ...

func (*MockClient) DisableUser

func (c *MockClient) DisableUser(username string) error

DisableUser for use with mock lib

func (*MockClient) ExecuteCheck

func (c *MockClient) ExecuteCheck(req *types.AdhocRequest) error

ExecuteCheck for use with mock lib

func (*MockClient) FetchAsset

func (c *MockClient) FetchAsset(name string) (*types.Asset, error)

FetchAsset for use with mock lib

func (*MockClient) FetchCheck

func (c *MockClient) FetchCheck(name string) (*types.CheckConfig, error)

FetchCheck for use with mock lib

func (*MockClient) FetchClusterID

func (c *MockClient) FetchClusterID() (string, error)

FetchClusterID ...

func (*MockClient) FetchClusterRole

func (c *MockClient) FetchClusterRole(name string) (*types.ClusterRole, error)

FetchClusterRole ...

func (*MockClient) FetchClusterRoleBinding

func (c *MockClient) FetchClusterRoleBinding(name string) (*types.ClusterRoleBinding, error)

FetchClusterRoleBinding ...

func (*MockClient) FetchEntity

func (c *MockClient) FetchEntity(ID string) (*types.Entity, error)

FetchEntity for use with mock lib

func (*MockClient) FetchEvent

func (c *MockClient) FetchEvent(entity, check string) (*types.Event, error)

FetchEvent for use with mock lib

func (*MockClient) FetchFilter

func (c *MockClient) FetchFilter(name string) (*types.EventFilter, error)

FetchFilter for use with mock lib

func (*MockClient) FetchHandler

func (c *MockClient) FetchHandler(name string) (*types.Handler, error)

FetchHandler for use with mock lib

func (*MockClient) FetchHook

func (c *MockClient) FetchHook(name string) (*types.HookConfig, error)

FetchHook for use with mock lib

func (*MockClient) FetchLicense

func (c *MockClient) FetchLicense() (interface{}, error)

FetchLicense for use with mock lib

func (*MockClient) FetchMutator

func (c *MockClient) FetchMutator(name string) (*types.Mutator, error)

FetchMutator for use with mock package

func (*MockClient) FetchNamespace

func (c *MockClient) FetchNamespace(namespace string) (*types.Namespace, error)

FetchNamespace for use with mock lib

func (*MockClient) FetchRole

func (c *MockClient) FetchRole(name string) (*types.Role, error)

FetchRole ...

func (*MockClient) FetchRoleBinding

func (c *MockClient) FetchRoleBinding(name string) (*types.RoleBinding, error)

FetchRoleBinding ...

func (*MockClient) FetchSilenced

func (c *MockClient) FetchSilenced(id string) (*types.Silenced, error)

FetchSilenced for use with mock lib

func (*MockClient) FetchUser

func (c *MockClient) FetchUser(username string) (*types.User, error)

FetchUser for use with mock lib

func (*MockClient) Get

func (c *MockClient) Get(path string, obj interface{}) error

Get ...

func (*MockClient) Health

func (c *MockClient) Health() (*types.HealthResponse, error)

Health ...

func (*MockClient) List

func (c *MockClient) List(path string, objs interface{}, options *client.ListOptions) error

List ...

func (*MockClient) ListAssets

func (c *MockClient) ListAssets(namespace string, options *client.ListOptions) ([]corev2.Asset, error)

ListAssets for use with mock lib

func (*MockClient) ListChecks

func (c *MockClient) ListChecks(namespace string, options *client.ListOptions) ([]corev2.CheckConfig, error)

ListChecks for use with mock lib

func (*MockClient) ListClusterRoleBindings

func (c *MockClient) ListClusterRoleBindings(options *client.ListOptions) ([]corev2.ClusterRoleBinding, error)

ListClusterRoleBindings ...

func (*MockClient) ListClusterRoles

func (c *MockClient) ListClusterRoles(options *client.ListOptions) ([]corev2.ClusterRole, error)

ListClusterRoles ...

func (*MockClient) ListEntities

func (c *MockClient) ListEntities(namespace string, options *client.ListOptions) ([]corev2.Entity, error)

ListEntities for use with mock lib

func (*MockClient) ListEvents

func (c *MockClient) ListEvents(namespace string, options *client.ListOptions) ([]corev2.Event, error)

ListEvents for use with mock lib

func (*MockClient) ListExtensions

func (c *MockClient) ListExtensions(namespace string, options *client.ListOptions) ([]corev2.Extension, error)

ListExtensions ...

func (*MockClient) ListFilters

func (c *MockClient) ListFilters(namespace string, options *client.ListOptions) ([]corev2.EventFilter, error)

ListFilters for use with mock lib

func (*MockClient) ListHandlers

func (c *MockClient) ListHandlers(namespace string, options *client.ListOptions) ([]corev2.Handler, error)

ListHandlers for use with mock package

func (*MockClient) ListHooks

func (c *MockClient) ListHooks(namespace string, options *client.ListOptions) ([]corev2.HookConfig, error)

ListHooks for use with mock lib

func (*MockClient) ListMutators

func (c *MockClient) ListMutators(namespace string, options *client.ListOptions) ([]corev2.Mutator, error)

ListMutators for use with mock lib

func (*MockClient) ListNamespaces

func (c *MockClient) ListNamespaces(options *client.ListOptions) ([]corev2.Namespace, error)

ListNamespaces for use with mock lib

func (*MockClient) ListRoleBindings

func (c *MockClient) ListRoleBindings(namespace string, options *client.ListOptions) ([]corev2.RoleBinding, error)

ListRoleBindings ...

func (*MockClient) ListRoles

func (c *MockClient) ListRoles(namespace string, options *client.ListOptions) ([]corev2.Role, error)

ListRoles ...

func (*MockClient) ListSilenceds

func (c *MockClient) ListSilenceds(namespace, sub, check string, options *client.ListOptions) ([]corev2.Silenced, error)

ListSilenceds for use with mock lib

func (*MockClient) ListUsers

func (c *MockClient) ListUsers(options *client.ListOptions) ([]corev2.User, error)

ListUsers for use with mock lib

func (*MockClient) Logout

func (c *MockClient) Logout(token string) error

Logout for use with mock lib

func (*MockClient) MemberAdd

func (c *MockClient) MemberAdd(peerAddrs []string) (*clientv3.MemberAddResponse, error)

MemberAdd ...

func (*MockClient) MemberList

func (c *MockClient) MemberList() (*clientv3.MemberListResponse, error)

MemberList ...

func (*MockClient) MemberRemove

func (c *MockClient) MemberRemove(id uint64) (*clientv3.MemberRemoveResponse, error)

MemberRemove ...

func (*MockClient) MemberUpdate

func (c *MockClient) MemberUpdate(id uint64, peerAddrs []string) (*clientv3.MemberUpdateResponse, error)

MemberUpdate ...

func (*MockClient) Post

func (c *MockClient) Post(path string, obj interface{}) error

Post ...

func (*MockClient) Put

func (c *MockClient) Put(path string, obj interface{}) error

Put ...

func (*MockClient) PutResource

func (c *MockClient) PutResource(r types.Wrapper) error

PutResource ...

func (*MockClient) RefreshAccessToken

func (c *MockClient) RefreshAccessToken(token string) (*types.Tokens, error)

RefreshAccessToken for use with mock lib

func (*MockClient) RegisterExtension

func (c *MockClient) RegisterExtension(e *types.Extension) error

RegisterExtension ...

func (*MockClient) ReinstateUser

func (c *MockClient) ReinstateUser(uname string) error

ReinstateUser for use with mock lib

func (*MockClient) RemoveAllGroupsFromUser

func (c *MockClient) RemoveAllGroupsFromUser(username string) error

RemoveAllGroupsFromUser for use with mock lib

func (*MockClient) RemoveCheckHook

func (c *MockClient) RemoveCheckHook(check *types.CheckConfig, hookType string, hookName string) error

RemoveCheckHook for use with mock lib

func (*MockClient) RemoveGroupFromUser

func (c *MockClient) RemoveGroupFromUser(username, group string) error

RemoveGroupFromUser for use with mock lib

func (*MockClient) ResolveEvent

func (c *MockClient) ResolveEvent(event *types.Event) error

ResolveEvent for use with mock lib

func (*MockClient) SetGroupsForUser

func (c *MockClient) SetGroupsForUser(username string, groups []string) error

SetGroupsForUser for use with mock lib

func (*MockClient) TestCreds

func (c *MockClient) TestCreds(u, p string) error

TestCreds for use with mock lib

func (*MockClient) UpdateAsset

func (c *MockClient) UpdateAsset(asset *types.Asset) error

UpdateAsset for use with mock lib

func (*MockClient) UpdateCheck

func (c *MockClient) UpdateCheck(check *types.CheckConfig) error

UpdateCheck for use with mock lib

func (*MockClient) UpdateEntity

func (c *MockClient) UpdateEntity(entity *types.Entity) error

UpdateEntity for use with mock lib

func (*MockClient) UpdateEvent

func (c *MockClient) UpdateEvent(event *types.Event) error

UpdateEvent for use with mock lib

func (*MockClient) UpdateFilter

func (c *MockClient) UpdateFilter(filter *types.EventFilter) error

UpdateFilter for use with mock lib

func (*MockClient) UpdateHandler

func (c *MockClient) UpdateHandler(h *types.Handler) error

UpdateHandler for use with mock lib

func (*MockClient) UpdateHook

func (c *MockClient) UpdateHook(hook *types.HookConfig) error

UpdateHook for use with mock lib

func (*MockClient) UpdateLicense

func (c *MockClient) UpdateLicense(license interface{}) error

UpdateLicense for use with mock lib

func (*MockClient) UpdateMutator

func (c *MockClient) UpdateMutator(m *types.Mutator) error

UpdateMutator for use with mock package

func (*MockClient) UpdateNamespace

func (c *MockClient) UpdateNamespace(namespace *types.Namespace) error

UpdateNamespace for use with mock lib

func (*MockClient) UpdatePassword

func (c *MockClient) UpdatePassword(username, pwd string) error

UpdatePassword for use with mock lib

func (*MockClient) UpdateSilenced

func (c *MockClient) UpdateSilenced(silenced *types.Silenced) error

UpdateSilenced for use with mock lib

type MockConfig

type MockConfig struct {
	mock.Mock
}

MockConfig is a configuration used for CLI testing. When using the MockConfig in unit tests, stub out the behavior you wish to test against by assigning the appropriate function to the appropriate Func field. If you have forgotten to stub a particular function, the program will panic.

func (*MockConfig) APIUrl

func (m *MockConfig) APIUrl() string

APIUrl mocks the API URL config

func (*MockConfig) Format

func (m *MockConfig) Format() string

Format mocks the format config

func (*MockConfig) Namespace

func (m *MockConfig) Namespace() string

Namespace mocks the namespace config

func (*MockConfig) SaveAPIUrl

func (m *MockConfig) SaveAPIUrl(url string) error

SaveAPIUrl mocks saving the API URL

func (*MockConfig) SaveFormat

func (m *MockConfig) SaveFormat(format string) error

SaveFormat mocks saving the format

func (*MockConfig) SaveNamespace

func (m *MockConfig) SaveNamespace(namespace string) error

SaveNamespace mocks saving the namespace

func (*MockConfig) SaveTokens

func (m *MockConfig) SaveTokens(tokens *types.Tokens) error

SaveTokens mocks saving the tokens

func (*MockConfig) Tokens

func (m *MockConfig) Tokens() *types.Tokens

Tokens mocks the tokens config

Jump to

Keyboard shortcuts

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