Documentation
¶
Overview ¶
Package servertest provides methods and types to test server.Handler implementations.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
Unimplemented = errors.New("Unimplemented")
)
Functions ¶
func Run ¶
Run executes all the given tests on the given Handler.
The same handler is used for all tests. The tests are executed in the given order. The requests received by the handler are as if the handler had been registered for the pattern "/a/test".
Each test is executed inside testing.T.Run, hence calling t.Fatal in the checker abort only the current test.
Types ¶
type CheckError ¶ added in v0.0.4
CheckError checks the statusCode and error message of a response.
type CheckJSON ¶ added in v0.0.4
type CheckJSON struct {
Code int // If zero, http.StatusOK is used instead.
Body interface{}
Partial bool // If true, Body may lack some field of the response.
}
CheckJSON checks that the response body is similar to the JSON marshaling of a given value.
type CheckStatus ¶ added in v0.0.4
type CheckStatus struct {
Code int
}
CheckStatus checks only the statusCode of a response.
type CheckerFun ¶ added in v0.0.4
type ClientStore ¶
type ClientStore struct {
Codecs []securecookie.Codec
}
ClientStore is a sessions.Store that store sessions in client requests.
func NewClientStore ¶
func NewClientStore(keys ...[]byte) *ClientStore
func (*ClientStore) Save ¶
func (self *ClientStore) Save(r *http.Request, w http.ResponseWriter, session *sessions.Session) error