Documentation
¶
Overview ¶
Package apptest is the HTTP harness of the tests of arkoren.dev/ark/access: a router with session and auth middleware behind an in-process server and a client that keeps cookies, like a browser. It imports core only (no driver), and only test files import it.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a cookie-keeping HTTP client of one test server.
func Serve ¶
func Serve(t *testing.T, store *cache.Cache, authenticators []auth.Authenticator, mount func(r *router.Router)) *Client
Serve starts a server whose router runs the session middleware over store and the auth middleware over authenticators, then calls mount to register the routes. The server stops with the test.
func ServeRouter ¶
ServeRouter starts a server for r, which must already run its own session middleware, and returns a cookie-keeping client. The server stops with the test.
func (*Client) Do ¶
Do sends method path with body (empty for none) and optional "Name: value" headers, and returns the reply. Redirects are not followed.