Documentation ¶
Overview ¶
Package test provides some utilities for integration testing at endpoint levels.
Index ¶
- func NewDB(t *testing.T) *db.DB
- type ReqOpt
- type TestServer
- func (ts *TestServer) Get(t *testing.T, path string, queries url.Values) *http.Request
- func (ts *TestServer) PostForm(t *testing.T, path string, body url.Values) *http.Request
- func (ts *TestServer) Serve(req *http.Request, opts ...ReqOpt) *http.Response
- func (ts *TestServer) WithAdmin(t *testing.T) ReqOpt
- func (ts *TestServer) WithMisaka(t *testing.T) ReqOpt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type TestServer ¶
TestServer wraps Server and adds some fancy stuff.
func NewServer ¶
func NewServer(t *testing.T) *TestServer
NewServer creates a new kjudge server running on a test database.
func (*TestServer) WithAdmin ¶
func (ts *TestServer) WithAdmin(t *testing.T) ReqOpt
WithAdmin logs in with the admin panel cookie for the next request.
func (*TestServer) WithMisaka ¶
func (ts *TestServer) WithMisaka(t *testing.T) ReqOpt
WithMisaka logs in as Misaka for the next request.
Click to show internal directories.
Click to hide internal directories.