testing

package
v0.0.0-...-be26699 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 3, 2015 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckRequest

func CheckRequest(c *gc.C, req *http.Request, method, user, pw, host, pth string)

CheckRequest verifies that the HTTP request matches the args as an API request should. We only check API-related request fields.

Types

type HTTPResponse

type HTTPResponse struct {
	http.Response
	// Buffer is the file underlying Body.
	Buffer bytes.Buffer
}

HTTPResponse is an HTTP response for use in testing.

func NewErrorResponse

func NewErrorResponse(statusCode int, msg string) *HTTPResponse

NewErrorResponse returns an HTTP response with the status and body set to the provided values.

func NewFailureResponse

func NewFailureResponse(failure *params.Error) *HTTPResponse

NewFailureResponse returns an HTTP response with the status set to 500 (Internal Server Error) and the body set to the JSON-encoded error.

func NewHTTPResponse

func NewHTTPResponse() *HTTPResponse

NewHTTPResponse returns an HTTP response with an OK status, no headers set, and an empty body.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL