mock

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthHandlerMock

type AuthHandlerMock struct {
	// RequireFunc mocks the Require method.
	RequireFunc func(required auth.Permissions, handler http.HandlerFunc) http.HandlerFunc
	// contains filtered or unexported fields
}

AuthHandlerMock is a mock implementation of api.AuthHandler.

    func TestSomethingThatUsesAuthHandler(t *testing.T) {

        // make and configure a mocked api.AuthHandler
        mockedAuthHandler := &AuthHandlerMock{
            RequireFunc: func(required auth.Permissions, handler http.HandlerFunc) http.HandlerFunc {
	               panic("mock out the Require method")
            },
        }

        // use mockedAuthHandler in code that requires api.AuthHandler
        // and then make assertions.

    }

func (*AuthHandlerMock) Require

func (mock *AuthHandlerMock) Require(required auth.Permissions, handler http.HandlerFunc) http.HandlerFunc

Require calls RequireFunc.

func (*AuthHandlerMock) RequireCalls

func (mock *AuthHandlerMock) RequireCalls() []struct {
	Required auth.Permissions
	Handler  http.HandlerFunc
}

RequireCalls gets all the calls that were made to Require. Check the length with:

len(mockedAuthHandler.RequireCalls())

type CacheMock

type CacheMock struct {
	// DeleteAllFunc mocks the DeleteAll method.
	DeleteAllFunc func() error

	// GetByIDFunc mocks the GetByID method.
	GetByIDFunc func(ID string) (*session.Session, error)

	// SetFunc mocks the Set method.
	SetFunc func(s *session.Session) error
	// contains filtered or unexported fields
}

CacheMock is a mock implementation of api.Cache.

    func TestSomethingThatUsesCache(t *testing.T) {

        // make and configure a mocked api.Cache
        mockedCache := &CacheMock{
            DeleteAllFunc: func() error {
	               panic("mock out the DeleteAll method")
            },
            GetByIDFunc: func(ID string) (*session.Session, error) {
	               panic("mock out the GetByID method")
            },
            SetFunc: func(s *session.Session) error {
	               panic("mock out the Set method")
            },
        }

        // use mockedCache in code that requires api.Cache
        // and then make assertions.

    }

func (*CacheMock) DeleteAll

func (mock *CacheMock) DeleteAll() error

DeleteAll calls DeleteAllFunc.

func (*CacheMock) DeleteAllCalls

func (mock *CacheMock) DeleteAllCalls() []struct {
}

DeleteAllCalls gets all the calls that were made to DeleteAll. Check the length with:

len(mockedCache.DeleteAllCalls())

func (*CacheMock) GetByID

func (mock *CacheMock) GetByID(ID string) (*session.Session, error)

GetByID calls GetByIDFunc.

func (*CacheMock) GetByIDCalls

func (mock *CacheMock) GetByIDCalls() []struct {
	ID string
}

GetByIDCalls gets all the calls that were made to GetByID. Check the length with:

len(mockedCache.GetByIDCalls())

func (*CacheMock) Set

func (mock *CacheMock) Set(s *session.Session) error

Set calls SetFunc.

func (*CacheMock) SetCalls

func (mock *CacheMock) SetCalls() []struct {
	S *session.Session
}

SetCalls gets all the calls that were made to Set. Check the length with:

len(mockedCache.SetCalls())

type SessionUpdaterMock

type SessionUpdaterMock struct {
	// UpdateFunc mocks the Update method.
	UpdateFunc func(email string) (*session.Session, error)
	// contains filtered or unexported fields
}

SessionUpdaterMock is a mock implementation of api.SessionUpdater.

    func TestSomethingThatUsesSessionUpdater(t *testing.T) {

        // make and configure a mocked api.SessionUpdater
        mockedSessionUpdater := &SessionUpdaterMock{
            UpdateFunc: func(email string) (*session.Session, error) {
	               panic("mock out the Update method")
            },
        }

        // use mockedSessionUpdater in code that requires api.SessionUpdater
        // and then make assertions.

    }

func (*SessionUpdaterMock) Update

func (mock *SessionUpdaterMock) Update(email string) (*session.Session, error)

Update calls UpdateFunc.

func (*SessionUpdaterMock) UpdateCalls

func (mock *SessionUpdaterMock) UpdateCalls() []struct {
	Email string
}

UpdateCalls gets all the calls that were made to Update. Check the length with:

len(mockedSessionUpdater.UpdateCalls())

Jump to

Keyboard shortcuts

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