admintest

package
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package admintest serves admin panels in tests, as the route an app gives them, and reads their screens and actions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func App

func App(t *testing.T, panel *admin.Admin, plugins ...kit.Plugin) http.Handler

App serves panel at /admin, with these other plugins first.

func Post

func Post(t *testing.T, h http.Handler, path string, form url.Values) (location, message string, status int)

Post runs an action and returns where it redirects, or the failure's message.

Types

type Page

type Page struct {
	Status   int
	View     string `json:"view"`
	Resource struct {
		Actions []admin.ActionInfo `json:"actions"`
		Edit    bool               `json:"edit"`
	} `json:"resource"`
	List struct {
		Rows []struct {
			Key    string            `json:"key"`
			Values map[string]string `json:"values"`
		} `json:"rows"`
		Total int `json:"total"`
	} `json:"list"`
	Record struct {
		Values map[string]string `json:"values"`
	} `json:"record"`
	Notice string `json:"notice"`
}

Page is a screen's data.

func Get

func Get(t *testing.T, h http.Handler, path string) Page

Get loads a screen.

Jump to

Keyboard shortcuts

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