gopherman

package module
v0.0.0-...-55178a5 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2025 License: MIT Imports: 13 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertErrors

func AssertErrors(t *testing.T, errs []error)

AssertErrors loops through the collected errors and t.Error's each of them

Types

type FakeWriter

type FakeWriter struct {
	StatusCode int
	Body       []byte
	// contains filtered or unexported fields
}

FakeWriter represenrs a fake http.ResponseWriter

func NewFakeWriter

func NewFakeWriter(headers http.Header) *FakeWriter

NewFakeWriter returns a new FakeWriter

func (*FakeWriter) Header

func (w *FakeWriter) Header() http.Header

Header returns the header

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

func (*TestHelper) Log

func (t *TestHelper) Log(msg string)

Log logs something

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

func NewTesterWithCollection(path string, envFile string, files ...string) (*Tester, error)

NewTesterWithCollection loads a collection from a file

func (*Tester) AugmentEnvironment

func (t *Tester) AugmentEnvironment(values map[string]string)

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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