Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertErrors ¶
AssertErrors loops through the collected errors and t.Error's each of them
Types ¶
type FakeWriter ¶
FakeWriter represenrs a fake http.ResponseWriter
func NewFakeWriter ¶
func NewFakeWriter(headers http.Header) *FakeWriter
NewFakeWriter returns a new FakeWriter
func (*FakeWriter) Write ¶
func (w *FakeWriter) Write(body []byte) (int, error)
Write writes the response body
func (*FakeWriter) WriteHeader ¶
func (w *FakeWriter) WriteHeader(statusCode int)
WriteHeader writes the header value
type RequestRecorder ¶
type RequestRecorder struct {
// contains filtered or unexported fields
}
RequestRecorder allows requests to an http server to be recorded
func NewRequestRecorder ¶
func NewRequestRecorder(mux http.Handler) *RequestRecorder
NewRequestRecorder returns a recorder ready to be used
func (*RequestRecorder) ServeHTTP ¶
func (rr *RequestRecorder) ServeHTTP(w http.ResponseWriter, r *http.Request)
type TestHelper ¶
type TestHelper struct { Assert *assert.Assertions // contains filtered or unexported fields }
TestHelper helps with running tests
func NewTestHelper ¶
func NewTestHelper(t *testing.T) *TestHelper
NewTestHelper creates a new test helper
func (*TestHelper) AnnotateErrors ¶
func (t *TestHelper) AnnotateErrors(collectionName, testName string) []error
AnnotateErrors adds collection and test names to errors held by t
func (*TestHelper) Error ¶
func (t *TestHelper) Error(err error)
func (*TestHelper) HasErrors ¶
func (t *TestHelper) HasErrors() bool
HasErrors returns true if the testhelper has errors
type Tester ¶
type Tester struct { Environment *postman.Environment Client *http.Client Collections []postman.Collection Hostname string Port string }
Tester represents a collection test tool
func NewTesterWithCollection ¶
NewTesterWithCollection loads a collection from a file
func (*Tester) AugmentEnvironment ¶
AugmentEnvironment of the Tester with one more key value pair. These are set to text with no description and as enabled.
func (*Tester) TestRequestWithName ¶
func (t *Tester) TestRequestWithName(name string, tst *testing.T, handler func(*TestHelper, *postman.Request, *postman.Response, *postman.Response)) []error
TestRequestWithName finds the named request in the collection, makes the same request, and then returns the request, expected response, and actual response