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 Checker ¶
Checker is a signature for functions that check the result of a request on a Handler.
func CheckerJSON ¶
CheckerJSON returns a Checker to check responses whose body is a JSON object.
The returned function checks that the statuc code and the body are as expected.
func CheckerStatus ¶
CheckerJSONString returns a Checker to check status code.
The returned function checks that the statuc code is as expected. The body is not checked.
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