tests

package
v7.0.0-...-1c7ecba Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckCookieOptions

func CheckCookieOptions(in *testInput)

func LoadSessionTests

func LoadSessionTests(in *testInput)

func PersistentSessionStoreInterfaceTests

func PersistentSessionStoreInterfaceTests(in *testInput)

func RunSessionStoreTests

func RunSessionStoreTests(newSS NewSessionStoreFunc, persistentFastForward PersistentStoreFastForwardFunc)

func SessionStoreInterfaceTests

func SessionStoreInterfaceTests(in *testInput)

Types

type MockLock

type MockLock struct {
	// contains filtered or unexported fields
}

func (*MockLock) FastForward

func (l *MockLock) FastForward(duration time.Duration)

FastForward simulates the flow of time to test expirations

func (*MockLock) Obtain

func (l *MockLock) Obtain(ctx context.Context, expiration time.Duration) error

func (*MockLock) Peek

func (l *MockLock) Peek(ctx context.Context) (bool, error)

func (*MockLock) Refresh

func (l *MockLock) Refresh(ctx context.Context, expiration time.Duration) error

func (*MockLock) Release

func (l *MockLock) Release(ctx context.Context) error

type MockStore

type MockStore struct {
	// contains filtered or unexported fields
}

MockStore is a generic in-memory implementation of persistence.Store for mocking in tests

func NewMockStore

func NewMockStore() *MockStore

NewMockStore creates a MockStore

func (*MockStore) Clear

func (s *MockStore) Clear(_ context.Context, key string) error

Clear deletes an entry from the memory cache

func (*MockStore) FastForward

func (s *MockStore) FastForward(duration time.Duration)

FastForward simulates the flow of time to test expirations

func (*MockStore) Load

func (s *MockStore) Load(_ context.Context, key string) ([]byte, error)

Load gets data from the memory cache via a key

func (*MockStore) Lock

func (s *MockStore) Lock(key string) sessions.Lock

func (*MockStore) Save

func (s *MockStore) Save(_ context.Context, key string, value []byte, exp time.Duration) error

Save sets a key to the data to the memory cache

func (*MockStore) VerifyConnection

func (s *MockStore) VerifyConnection(_ context.Context) error

type NewSessionStoreFunc

type NewSessionStoreFunc func(sessionOpts *options.SessionOptions, cookieOpts *options.Cookie) (sessionsapi.SessionStore, error)

NewSessionStoreFunc allows any session store implementation to configure their own session store before each test.

type PersistentStoreFastForwardFunc

type PersistentStoreFastForwardFunc func(time.Duration) error

PersistentStoreFastForwardFunc is used to adjust the time of the persistent store to fast forward expiry of sessions.

Jump to

Keyboard shortcuts

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