Documentation
¶
Overview ¶
Package testserver serves the real API on a base of its own, for the tests of its clients (the routes, the CLI, the MCP, the OAuth).
Index ¶
Constants ¶
const Password = "correct horse"
Password is the password of the account Serve makes.
Variables ¶
var Single = domain.ServerMode{Mode: domain.Modes[0], AddUserMode: domain.AddUserModes[0]}
Single is the mode of Serve: the default of serve.
Functions ¶
This section is empty.
Types ¶
type Server ¶
type Server struct {
DB *bun.DB
URL string
// Session is the token of a session, as the CLI sends it.
Session string
// Ctx acts for the account of Session, for the processes a test runs on DB.
Ctx context.Context
}
Server is the API under test.
func Serve ¶
Serve starts the API in the single mode on a new base of one account whose password is Password, logged in once.
func ServeMode ¶ added in v0.6.0
func ServeMode(t testing.TB, mode domain.ServerMode) *Server
ServeMode starts the API in mode on a new base of one admin account, named admin, whose password is Password, logged in once.