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 ¶
- func ApplyAuthSchema(t testing.TB, db *sql.DB, engine string)
- func Conformance(t *testing.T, newStore func(t *testing.T) *authn.Store)
- func Grant(t testing.TB, s *authn.Store, tenantID string, p authn.Principal, ...)
- func NewSQLiteStore(t testing.TB) *authn.Store
- func SameTenantID(_ context.Context, slug string) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyAuthSchema ¶
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 ¶
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 ¶
NewSQLiteStore returns a Store over a fresh, fully migrated SQLite auth DB in the test's temp dir.
Types ¶
This section is empty.