Versions in this module Expand all Collapse all v0 v0.11.0 Jul 6, 2026 Changes in this version + func AssertAdminColumn(t TestHelper, response *Response, column string) + func AssertAdminModelRegistered(t TestHelper, registry *admin.Registry, label string) + func AssertAdminPage(t TestHelper, response *Response, text string) + func AssertEmailSent(t TestHelper, outbox *MailOutbox, subject string) + func AssertEqualJSON(t TestHelper, actual any, expected any) + func AssertHasFieldError(t TestHelper, errors any, field string, message string) + func AssertHasNonFieldError(t TestHelper, errors any, message string) + func AssertPermissionDenied(t TestHelper, user auth.User, permission string) + func AssertPermissionGranted(t TestHelper, user auth.User, permission string) + func AssertQueryCount(t TestHelper, counter QueryCount, expected int) + func AssertSignalSent(t TestHelper, responses []signals.Response) + func AssertTaskEnqueued(t TestHelper, harness *QueueHarness, name string) + func LoadFixtures(ctx context.Context, database *TestDatabase, fixtures []Fixture) error + func ModelTableName(model string) string + func RecordFormErrors(w http.ResponseWriter, errors map[string][]string) + func RecordTemplate(w http.ResponseWriter, name string) + func TemporarySettings(base conf.Settings, options ...SettingsOption) conf.Settings + func TransactionalFixtures(ctx context.Context, database *TestDatabase, fixtures []Fixture, ...) error + type AdminClient struct + func NewAdminClient(handler http.Handler) *AdminClient + func (c *AdminClient) Login(user auth.User) *AdminClient + type CleanupHelper interface + Cleanup func(func()) + Helper func() + type Client struct + func NewClient(handler http.Handler) *Client + func (c *Client) Delete(path string) *Response + func (c *Client) Do(method string, path string, body io.Reader, headers map[string]string) *Response + func (c *Client) FollowRedirects(enabled bool) *Client + func (c *Client) ForceLogin(user auth.User) *Client + func (c *Client) Get(path string) *Response + func (c *Client) JSON(method string, path string, payload any) *Response + func (c *Client) Options(path string) *Response + func (c *Client) Patch(path string, body string) *Response + func (c *Client) PatchJSON(path string, payload any) *Response + func (c *Client) Post(path string, body string) *Response + func (c *Client) PostForm(path string, values url.Values) *Response + func (c *Client) PostJSON(path string, payload any) *Response + func (c *Client) PostMultipart(path string, fields map[string]string, files map[string]MultipartFile) *Response + func (c *Client) Put(path string, body string) *Response + func (c *Client) PutJSON(path string, payload any) *Response + func (c *Client) SetCookie(cookie *http.Cookie) *Client + func (c *Client) WithSession(session *sessions.Session) *Client + type Factory struct + func NewFactory(model string, defaults map[string]any) *Factory + func (f *Factory) Build(overrides map[string]any) Fixture + func (f *Factory) BuildMany(count int) []Fixture + func (f *Factory) WithNaturalKey(fields ...string) *Factory + type Fixture struct + Fields map[string]any + Model string + NaturalKey []any + PK any + func DumpFixtures(ctx context.Context, database *TestDatabase, model string) ([]Fixture, error) + type FixtureRow struct + Table string + Values map[string]any + func FixtureRows(fixtures []Fixture) []FixtureRow + type MailOutbox struct + func NewMailOutbox() *MailOutbox + func (o *MailOutbox) AssertEmailSent(t TestHelper, subject string) + func (o *MailOutbox) Backend() *email.MemoryBackend + func (o *MailOutbox) Clear() + func (o *MailOutbox) Messages() []email.Message + func (o *MailOutbox) Send(ctx context.Context, messages ...email.Message) (int, error) + type MultipartFile struct + Content io.Reader + ContentType string + Filename string + type QueryCount interface + Count func() int + type QueryCounter struct + func NewQueryCounter() *QueryCounter + func (c *QueryCounter) Count() int + func (c *QueryCounter) Record() + type QueueHarness struct + App *queue.App + Backend *backends.MemoryBackend + Broker *brokers.MemoryBroker + func NewQueueHarness(app *queue.App) *QueueHarness + func (h *QueueHarness) Apply(ctx context.Context, signature queue.Signature) (queue.Result, error) + func (h *QueueHarness) AssertTaskEnqueued(t TestHelper, name string) + func (h *QueueHarness) Enqueue(ctx context.Context, signature queue.Signature) (queue.Envelope, error) + func (h *QueueHarness) Enqueued() []queue.Envelope + type Response struct + Body string + Cookies []*http.Cookie + Header http.Header + RedirectChain []string + Request *http.Request + StatusCode int + func (r *Response) AssertBodyContains(t TestHelper, value string) + func (r *Response) AssertFormError(t TestHelper, field string, message string) + func (r *Response) AssertHeader(t TestHelper, name string, value string) + func (r *Response) AssertJSONPath(t TestHelper, path string, want any) + func (r *Response) AssertNonFieldError(t TestHelper, message string) + func (r *Response) AssertRedirect(t TestHelper, target string) + func (r *Response) AssertStatus(t TestHelper, status int) + func (r *Response) AssertTemplateUsed(t TestHelper, name string) + type SQLSchemaEditor struct + DB *sql.DB + func (e SQLSchemaEditor) Execute(ctx context.Context, statement string, args ...any) error + type Sequence func(int) any + func Seq(fn func(int) any) Sequence + type SettingsOption func(*conf.Settings) + func WithDatabaseURL(databaseURL string) SettingsOption + func WithInstalledApps(apps ...string) SettingsOption + func WithMiddleware(middleware ...string) SettingsOption + func WithTemplateDirs(dirs ...string) SettingsOption + func WithTemporaryDatabase(database *TestDatabase) SettingsOption + type SettingsOverride struct + func OverrideSettings(target *conf.Settings, options ...SettingsOption) *SettingsOverride + func OverrideSettingsForTest(t CleanupHelper, target *conf.Settings, options ...SettingsOption) *SettingsOverride + func (o *SettingsOverride) Restore() + type TestDatabase struct + Database *orm.Database + Path string + func NewPostgresTestDatabase(ctx context.Context, dsn string) (*TestDatabase, error) + func NewSQLiteTestDatabase(ctx context.Context) (*TestDatabase, error) + func (d *TestDatabase) ApplyMigrations(ctx context.Context, migrationList []migrations.Migration) error + func (d *TestDatabase) Close() error + func (d *TestDatabase) LoadFixtures(ctx context.Context, rows []FixtureRow) error + func (d *TestDatabase) Reset(ctx context.Context) error + func (d *TestDatabase) RollbackTransaction(ctx context.Context, fn func(context.Context, Transaction) error) (err error) + func (d *TestDatabase) SQLDB() *sql.DB + func (d *TestDatabase) TableExists(ctx context.Context, table string) (bool, error) + func (d *TestDatabase) Transaction(ctx context.Context, fn func(context.Context, Transaction) error) (err error) + type TestHelper interface + Fatalf func(string, ...any) + Helper func() + type Transaction interface + ExecContext func(context.Context, string, ...any) (sql.Result, error) + QueryContext func(context.Context, string, ...any) (*sql.Rows, error) + QueryRowContext func(context.Context, string, ...any) *sql.Row