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

oauth2test

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package oauth2test provides a backend-agnostic conformance suite for the oauth2provider.Store interface. Every backend (memory, sqlite, postgres, mongo) is expected to pass the same contract, so behavioral drift between implementations is caught here rather than in production.

It mirrors store/storetest, which does the same job for the core store.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunConformance

func RunConformance(t *testing.T, newFixture Factory, skip ...string)

RunConformance runs every contract test against fixtures from newFixture. Names in skip are not run, for backends that legitimately cannot support a case; skipping anything else is a bug in the backend, not in the suite.

Types

type Factory

type Factory func(t *testing.T) Fixture

Factory builds a fresh, empty, migrated fixture for a single test.

type Fixture

type Fixture struct {
	Store oauth2provider.Store
	AppID id.AppID
	// UserID must exist in authsome_users for backends that enforce the
	// auth-code foreign key.
	UserID id.UserID
	// OtherAppID is a second tenant, used to prove app scoping. Backends that
	// cannot seed one may leave it zero and the scoping case is skipped.
	OtherAppID id.AppID
}

Fixture is one backend ready to test: a migrated plugin store plus the tenant rows its foreign keys point at. The SQL backends reference authsome_apps and authsome_users, so a suite cannot invent those ids.

func (Fixture) OtherUserID

func (f Fixture) OtherUserID() id.UserID

OtherUserID is a user id that owns nothing in the fixture, for proving per-user scoping without a second seeded user.

Jump to

Keyboard shortcuts

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