Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertJSONCall ¶
func AssertJSONCall(c *gc.C, p JSONCallParams)
AssertJSONCall asserts that when the given handler is called with the given parameters, the result is as specified.
func DoRequest ¶
func DoRequest(c *gc.C, handler http.Handler, method string, urlStr string, body io.Reader, contentLength int64, header map[string][]string) *httptest.ResponseRecorder
DoRequest invokes a request on the given handler with the given method, URL, body, content length and headers.
func MongoJSEnabled ¶
func MongoJSEnabled() bool
MongoJSEnabled reports whether testing code should run tests that rely on JavaScript inside MongoDB.
Types ¶
type IsolatedMgoSuite ¶
type IsolatedMgoSuite struct {
jujutesting.IsolationSuite
jujutesting.MgoSuite
}
func (*IsolatedMgoSuite) SetUpSuite ¶
func (s *IsolatedMgoSuite) SetUpSuite(c *gc.C)
func (*IsolatedMgoSuite) SetUpTest ¶
func (s *IsolatedMgoSuite) SetUpTest(c *gc.C)
func (*IsolatedMgoSuite) TearDownSuite ¶
func (s *IsolatedMgoSuite) TearDownSuite(c *gc.C)
func (*IsolatedMgoSuite) TearDownTest ¶
func (s *IsolatedMgoSuite) TearDownTest(c *gc.C)
type JSONCallParams ¶
type JSONCallParams struct {
// Handler holds the handler to use to make the request.
Handler http.Handler
// Method holds the HTTP method to use for the call.
// GET is assumed if this is empty.
Method string
// URL holds the URL to pass when making the request.
URL string
// Body holds the body to send in the request.
Body io.Reader
// Header specifies the HTTP headers to use when making
// the request.
Header http.Header
// ContentLength specifies the length of the body.
// It may be zero, in which case the default net/http
// content-length behaviour will be used.
ContentLength int64
// ExpectCode holds the expected HTTP status code.
// http.StatusOK is assumed if this is zero.
// TODO(rog) change this to ExpectStatus
ExpectCode int
// ExpectBody holds the expected JSON body.
ExpectBody interface{}
}
JSONCallParams holds parameters for AssertJSONCall. If left empty, some fields will automatically be filled with defaults.
Click to show internal directories.
Click to hide internal directories.