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

testadmin

package
v0.79.3 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2026 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fixture

type Fixture struct {
	Admin      *admin.Service
	Server     *server.Server
	ServerOpts *server.Options
	Audience   *runtimeauth.Audience
}

Fixture is a test fixture for an admin service and server. It wraps an admin service with a server running on a random port backed by a testcontainer Postgres database. The service, server and other resources will be cleaned up when the test that created the Fixture stops.

The service has several limitations compared to a production server: - Cannot provision runtimes - Github operation are no-ops - Billing operations are no-ops - No configured metrics project - Does not run background jobs

func New

func New(t *testing.T) *Fixture

New creates an ephemeral admin service and server for testing. See the docstring for the returned Fixture for details.

func (*Fixture) ExternalURL

func (f *Fixture) ExternalURL() string

ExternalURL returns the localhost URL of the fixture's server.

func (*Fixture) NewClient

func (f *Fixture) NewClient(t *testing.T, token string) *client.Client

NewClient creates a new client for the fixture's server.

func (*Fixture) NewSuperuser

func (f *Fixture) NewSuperuser(t *testing.T) (*database.User, *client.Client)

NewSuperuser creates a new user with superuser permission in the fixture's admin service.

func (*Fixture) NewUser

func (f *Fixture) NewUser(t *testing.T) (*database.User, *client.Client)

NewUser creates a new user in the fixture's admin service.

func (*Fixture) NewUserWithDomain

func (f *Fixture) NewUserWithDomain(t *testing.T, domain string) (*database.User, *client.Client)

NewUserWithDomain creates a new user with a random email with the given email domain in the fixture's admin service.

func (*Fixture) NewUserWithEmail

func (f *Fixture) NewUserWithEmail(t *testing.T, emailAddr string) (*database.User, *client.Client)

NewUserWithEmail creates a new user with the given email in the fixture's admin service.

Jump to

Keyboard shortcuts

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