mock

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package mock provides mocks for secretstorage package.

Index

Constants

This section is empty.

Variables

View Source
var Anything = mock.Anything

Anything is an alias of mock.Anything.

View Source
var NopKeyring = MockKeyring()

NopKeyring is no mock Keyring.

Functions

This section is empty.

Types

type Keyring

type Keyring struct {
	mock.Mock
}

Keyring is an autogenerated mock type for the Keyring type

func NewKeyring

func NewKeyring(t interface {
	mock.TestingT
	Cleanup(func())
}) *Keyring

NewKeyring creates a new instance of Keyring. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*Keyring) Delete

func (_m *Keyring) Delete(service string, user string) error

Delete provides a mock function with given fields: service, user

func (*Keyring) Get

func (_m *Keyring) Get(service string, user string) (string, error)

Get provides a mock function with given fields: service, user

func (*Keyring) Set

func (_m *Keyring) Set(service string, user string, password string) error

Set provides a mock function with given fields: service, user, password

type KeyringMocker

type KeyringMocker func(tb testing.TB) *Keyring

KeyringMocker is Keyring mocker.

func MockKeyring

func MockKeyring(mocks ...func(k *Keyring)) KeyringMocker

MockKeyring creates Keyring mock with cleanup to ensure all the expectations are met.

type Storage

type Storage[V interface{}] struct {
	mock.Mock
}

Storage is an autogenerated mock type for the Storage type

func NewStorage

func NewStorage[V interface{}](t interface {
	mock.TestingT
	Cleanup(func())
}) *Storage[V]

NewStorage creates a new instance of Storage. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*Storage[V]) Delete

func (_m *Storage[V]) Delete(service string, key string) error

Delete provides a mock function with given fields: service, key

func (*Storage[V]) Get

func (_m *Storage[V]) Get(service string, key string) (V, error)

Get provides a mock function with given fields: service, key

func (*Storage[V]) Set

func (_m *Storage[V]) Set(service string, key string, value V) error

Set provides a mock function with given fields: service, key, value

type StorageMocker

type StorageMocker[V any] func(tb testing.TB) *Storage[V]

StorageMocker is Storage mocker.

func MockStorage

func MockStorage[V any](mocks ...func(s *Storage[V])) StorageMocker[V]

MockStorage creates Storage mock with cleanup to ensure all the expectations are met.

Jump to

Keyboard shortcuts

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