testing

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2017 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OCTET_STREAM = "application/octet-stream"
	JSON         = "application/json; charset=utf-8"
	TEXT         = "text/plain"
)

Variables

View Source
var DefaultRoundTripper http.RoundTripper = &http.Transport{
	Proxy: http.ProxyFromEnvironment,
	DialContext: (&net.Dialer{
		Timeout:   30 * time.Second,
		KeepAlive: 30 * time.Second,
	}).DialContext,
	MaxIdleConns:          100,
	IdleConnTimeout:       90 * time.Second,
	TLSHandshakeTimeout:   10 * time.Second,
	ExpectContinueTimeout: 1 * time.Second,
}

Functions

func AssertEqualSlice added in v1.3.0

func AssertEqualSlice(expected []string, actual []string, t *testing.T)

func ResetDefaultRoundTripper

func ResetDefaultRoundTripper()

Types

type CannedResponse added in v1.1.0

type CannedResponse struct {
	ResponseType ResponseType
	Response     string
	ContentType  string
}

type ExpectedCommand added in v1.3.0

type ExpectedCommand struct {
	// contains filtered or unexported fields
}

type FakeRunner added in v1.3.0

type FakeRunner struct {
	*Runner
}

func NewFakeRunner added in v1.3.0

func NewFakeRunner(test *testing.T) *FakeRunner

func (*FakeRunner) ExpectAndReturn added in v1.3.0

func (f *FakeRunner) ExpectAndReturn(input string, output string)

type MockRoundTripper

type MockRoundTripper struct {
	// contains filtered or unexported fields
}

MockRoundTripper mocks HTTP requests and allows to return canned responses

func NewMockRoundTripper

func NewMockRoundTripper() *MockRoundTripper

func (*MockRoundTripper) AllowDelegation added in v1.1.0

func (t *MockRoundTripper) AllowDelegation(delegate bool)

func (*MockRoundTripper) RegisterResponse added in v1.1.0

func (t *MockRoundTripper) RegisterResponse(url string, response *CannedResponse)

func (*MockRoundTripper) RoundTrip

func (t *MockRoundTripper) RoundTrip(req *http.Request) (*http.Response, error)

func (*MockRoundTripper) Verbose added in v1.1.0

func (t *MockRoundTripper) Verbose(verbose bool)

type ResponseType added in v1.1.0

type ResponseType int
const (
	SERVE_STRING ResponseType = iota
	SERVE_FILE
)

type Runner added in v1.3.0

type Runner struct{}

func (*Runner) Output added in v1.3.0

func (f *Runner) Output(command string, args ...string) ([]byte, error)

func (*Runner) Run added in v1.3.0

func (f *Runner) Run(stdOut io.Writer, stdErr io.Writer, commandPath string, args ...string) int

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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