3
// This package provides an HTTPSuite infrastructure that lets you bring up an
4
// HTTP server. The server will handle requests based on whatever Handlers are
5
// attached to HTTPSuite.Mux. This Mux is reset after every test case, and the
6
// server is shut down at the end of the test suite.
9
. "launchpad.net/gocheck"
14
var _ = Suite(&HTTPSuite{})
16
type HTTPSuite struct {
17
Server *httptest.Server
19
oldHandler http.Handler
22
func (s *HTTPSuite) SetUpSuite(c *C) {
23
// fmt.Printf("Starting New Server\n")
24
s.Server = httptest.NewServer(nil)
27
func (s *HTTPSuite) SetUpTest(c *C) {
28
s.oldHandler = s.Server.Config.Handler
29
s.Mux = http.NewServeMux()
30
s.Server.Config.Handler = s.Mux
33
func (s *HTTPSuite) TearDownTest(c *C) {
35
s.Server.Config.Handler = s.oldHandler
38
func (s *HTTPSuite) TearDownSuite(c *C) {
40
// fmt.Printf("Stopping Server\n")