mock

package
v0.0.0-...-3975a26 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SessionStore

type SessionStore struct {
	// CreateFunc mocks the Create method.
	CreateFunc func(ctx context.Context, s sessionup.Session) error

	// DeleteByIDFunc mocks the DeleteByID method.
	DeleteByIDFunc func(ctx context.Context, id string) error

	// DeleteByUserKeyFunc mocks the DeleteByUserKey method.
	DeleteByUserKeyFunc func(ctx context.Context, key string, expID ...string) error

	// FetchByIDFunc mocks the FetchByID method.
	FetchByIDFunc func(ctx context.Context, id string) (sessionup.Session, bool, error)

	// FetchByUserKeyFunc mocks the FetchByUserKey method.
	FetchByUserKeyFunc func(ctx context.Context, key string) ([]sessionup.Session, error)
	// contains filtered or unexported fields
}

SessionStore is a mock implementation of sessionup.Store.

    func TestSomethingThatUsesStore(t *testing.T) {

        // make and configure a mocked sessionup.Store
        mockedStore := &SessionStore{
            CreateFunc: func(ctx context.Context, s sessionup.Session) error {
	               panic("mock out the Create method")
            },
            DeleteByIDFunc: func(ctx context.Context, id string) error {
	               panic("mock out the DeleteByID method")
            },
            DeleteByUserKeyFunc: func(ctx context.Context, key string, expID ...string) error {
	               panic("mock out the DeleteByUserKey method")
            },
            FetchByIDFunc: func(ctx context.Context, id string) (sessionup.Session, bool, error) {
	               panic("mock out the FetchByID method")
            },
            FetchByUserKeyFunc: func(ctx context.Context, key string) ([]sessionup.Session, error) {
	               panic("mock out the FetchByUserKey method")
            },
        }

        // use mockedStore in code that requires sessionup.Store
        // and then make assertions.

    }

func (*SessionStore) Create

func (mock *SessionStore) Create(ctx context.Context, s sessionup.Session) error

Create calls CreateFunc.

func (*SessionStore) CreateCalls

func (mock *SessionStore) CreateCalls() []struct {
	Ctx context.Context
	S   sessionup.Session
}

CreateCalls gets all the calls that were made to Create. Check the length with:

len(mockedStore.CreateCalls())

func (*SessionStore) DeleteByID

func (mock *SessionStore) DeleteByID(ctx context.Context, id string) error

DeleteByID calls DeleteByIDFunc.

func (*SessionStore) DeleteByIDCalls

func (mock *SessionStore) DeleteByIDCalls() []struct {
	Ctx context.Context
	ID  string
}

DeleteByIDCalls gets all the calls that were made to DeleteByID. Check the length with:

len(mockedStore.DeleteByIDCalls())

func (*SessionStore) DeleteByUserKey

func (mock *SessionStore) DeleteByUserKey(ctx context.Context, key string, expID ...string) error

DeleteByUserKey calls DeleteByUserKeyFunc.

func (*SessionStore) DeleteByUserKeyCalls

func (mock *SessionStore) DeleteByUserKeyCalls() []struct {
	Ctx   context.Context
	Key   string
	ExpID []string
}

DeleteByUserKeyCalls gets all the calls that were made to DeleteByUserKey. Check the length with:

len(mockedStore.DeleteByUserKeyCalls())

func (*SessionStore) FetchByID

func (mock *SessionStore) FetchByID(ctx context.Context, id string) (sessionup.Session, bool, error)

FetchByID calls FetchByIDFunc.

func (*SessionStore) FetchByIDCalls

func (mock *SessionStore) FetchByIDCalls() []struct {
	Ctx context.Context
	ID  string
}

FetchByIDCalls gets all the calls that were made to FetchByID. Check the length with:

len(mockedStore.FetchByIDCalls())

func (*SessionStore) FetchByUserKey

func (mock *SessionStore) FetchByUserKey(ctx context.Context, key string) ([]sessionup.Session, error)

FetchByUserKey calls FetchByUserKeyFunc.

func (*SessionStore) FetchByUserKeyCalls

func (mock *SessionStore) FetchByUserKeyCalls() []struct {
	Ctx context.Context
	Key string
}

FetchByUserKeyCalls gets all the calls that were made to FetchByUserKey. Check the length with:

len(mockedStore.FetchByUserKeyCalls())

Jump to

Keyboard shortcuts

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