Help us shape the future of Go! Take the 2026 Go Developer Survey

authntest

package
v0.2.50 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: MPL-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package authntest holds the identity store's behaviour suite and the helpers to stand a store up in a test. The suite runs on SQLite here (chassis/authn) and on a real Postgres in the cloud overlay, so the two engines are held to one contract — the same split as vector/vectortest.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyAuthSchema

func ApplyAuthSchema(t testing.TB, db *sql.DB, engine string)

ApplyAuthSchema applies every embedded auth migration for the engine ("sqlite" or "postgres"), in order, as the boot runner would on a fresh DB.

func Conformance

func Conformance(t *testing.T, newStore func(t *testing.T) *authn.Store)

Conformance is the store's behaviour suite. newStore returns a store over a migrated auth DB; it may hand back the same database every time.

func Grant

func Grant(t testing.TB, s *authn.Store, tenantID string, p authn.Principal, username, password string, scopes ...string)

Grant makes username sign in as p with password, for a head's tests — which need to know the password, where the store only ever generates one. It binds the username (as stack `web`), then gives p a credential holding exactly password with the given scopes. password must carry a short id, as an issued one does (authn.ShortIDOf): "bcdf-secret" does. Granting the same short id to p again replaces its password.

func NewSQLiteStore

func NewSQLiteStore(t testing.TB) *authn.Store

NewSQLiteStore returns a Store over a fresh, fully migrated SQLite auth DB in the test's temp dir.

func SameTenantID

func SameTenantID(_ context.Context, slug string) (string, error)

SameTenantID is a ResolverConfig.TenantID for tests whose tenants use the same string for slug and id.

Types

This section is empty.

Jump to

Keyboard shortcuts

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