servertest

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: AGPL-3.0 Imports: 16 Imported by: 0 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 servertest starts a complete braid-server against a fresh test database and a mock OIDC provider.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Env

type Env struct {
	URL      string
	OwnerURL string
	AppURL   string
	IdP      *oidctest.Provider
	Client   func() *http.Client // fresh TLS client with cookie jar
}

Env is a running test server.

func Start

func Start(t testing.TB, opts ...server.Option) *Env

Start builds the server; everything is torn down when t finishes.

func (*Env) Login

func (e *Env) Login(t testing.TB, sub string, groups ...string) *http.Client

Login returns a client logged in as sub with groups.

func (*Env) LoginUser

func (e *Env) LoginUser(t testing.TB, user oidctest.User) *http.Client

LoginUser returns a client logged in as the given IdP user.

func (*Env) NewDevice

func (e *Env) NewDevice(t testing.TB, c *http.Client, name string) (token, deviceID string)

NewDevice runs the complete device flow: code, approve via c, poll; returns token and device id.

Jump to

Keyboard shortcuts

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