Documentation
¶
Overview ¶
Package that enables you to write unit tests that rely on a context.Context object.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var TestRequest *http.Request
TestRequest is the most recent test *http.Request object that was created and used in a WebContext.
var TestResponseWriter *http_test.TestResponseWriter
TestResponseWriter is the most recent testify/http/TestResponseWriter object that was used in the WebContext. It will contain the last response.
Functions ¶
func MakeTestContext ¶
func MakeTestContext() *webcontext.WebContext
MakeTestContext makes a *webcontext.WebContext (that can be used as a context.Context) that can be used for esting.
func MakeTestContextWithDetails ¶
func MakeTestContextWithDetails(path, method string) *webcontext.WebContext
MakeTestContextWithDetails makes a *webcontext.WebContext with the specified path and HTTP Method.
func MakeTestContextWithFullDetails ¶
func MakeTestContextWithFullDetails(path, method, body string) *webcontext.WebContext
MakeTestContextWithFullDetails makes a *webcontext.WebContext with the specified path, HTTP Method and body string.
func MakeTestContextWithPath ¶
func MakeTestContextWithPath(path string) *webcontext.WebContext
MakeTestContextWithPath makes a *webcontext.WebContext for testing with the specified path.
webcontext_test.MakeTestContextWithPath("http://mysite.com/path/{var}?queryparam1=1")
Types ¶
This section is empty.