Documentation
¶
Overview ¶
Package storetest is a conformance suite for store implementations.
Every store shipped with the library runs it, and so should yours:
func TestSessions(t *testing.T) {
storetest.Sessions(t, func(t *testing.T) session.Store { return newMyStore(t) })
}
Each factory call must return an empty store.
Index ¶
- func InviteManager(t *testing.T, newStore func(t *testing.T) ManagedInviteStore)
- func Invites(t *testing.T, newStore func(t *testing.T) invite.Store)
- func Limiter(t *testing.T, ...)
- func MFA(t *testing.T, newStore func(t *testing.T) mfa.Store)
- func Passkeys(t *testing.T, newStore func(t *testing.T) passkey.Store)
- func Purger(t *testing.T, newStore func(t *testing.T) PurgingSessionStore)
- func Sessions(t *testing.T, newStore func(t *testing.T) session.Store)
- func Tokens(t *testing.T, newStore func(t *testing.T) onetime.Store)
- func Users(t *testing.T, newStore func(t *testing.T) UserStore)
- func UsersWith(t *testing.T, newStore func(t *testing.T) UserStore, opts UsersOptions)
- type ManagedInviteStore
- type PurgingSessionStore
- type UserStore
- type UsersOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InviteManager ¶ added in v2.4.0
func InviteManager(t *testing.T, newStore func(t *testing.T) ManagedInviteStore)
InviteManager runs the invite.Manager conformance tests.
func Limiter ¶ added in v2.4.0
Limiter runs the ratelimit.Limiter conformance tests: the semantics of ratelimit.Memory, which every shared limiter must match. newLimiter must return a limiter built from cfg (whose Now is a test clock) with no recorded failures.
func Purger ¶ added in v2.3.0
func Purger(t *testing.T, newStore func(t *testing.T) PurgingSessionStore)
Purger runs the session.Purger conformance tests.
Types ¶
type ManagedInviteStore ¶ added in v2.4.0
ManagedInviteStore is what InviteManager needs.
type PurgingSessionStore ¶ added in v2.3.0
PurgingSessionStore is what Purger needs.
type UserStore ¶
type UserStore interface {
iam.UserStore
password.CredentialStore
}
UserStore is what Users needs: subjects, identities and credentials.
type UsersOptions ¶ added in v2.1.0
type UsersOptions struct {
// Roles are granted to the first subject the suite creates, and must be
// returned by LoadSubject, in any order. Default: editor, reader.
// Set it for stores that allow one role per subject, or only known roles.
Roles []string
// DefaultRoles are granted to the second subject (an empty grant by
// default). Set it for stores that require at least one role.
DefaultRoles []string
}
UsersOptions adapts the Users suite to stores with stricter rules than IAM requires. The zero value is the default suite.