storetest

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2026 License: MIT Imports: 13 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func Invites

func Invites(t *testing.T, newStore func(t *testing.T) invite.Store)

Invites runs the invite.Store conformance tests.

func Sessions

func Sessions(t *testing.T, newStore func(t *testing.T) session.Store)

Sessions runs the session.Store conformance tests.

func Users

func Users(t *testing.T, newStore func(t *testing.T) UserStore)

Users runs the iam.UserStore and password.CredentialStore conformance tests.

func UsersWith added in v2.1.0

func UsersWith(t *testing.T, newStore func(t *testing.T) UserStore, opts UsersOptions)

UsersWith runs the Users suite with options.

Types

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 the same 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.

Jump to

Keyboard shortcuts

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