test

package
v0.0.0-...-e560ebb Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2021 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeServer

type FakeServer struct {
	// JSONResponse will always be returned (json-encoded) for any request to the server.
	JSONResponse interface{}
	// PerURLResponse allows test clients to mock out specific URLs that are requested from this server.
	// If a URL matches, the resulting json-encoded blob will be returned, rather than JSONResponse.
	PerURLResponse map[string]interface{}
	// Server is the local in-process server used for faking a service.
	Server *httptest.Server
}

FakeServer is a test helper to run local in-process http servers for testing fakes.

func NewFakeServer

func NewFakeServer() *FakeServer

NewFakeServer returns a new *FakeServer. It is up to callers to remember to call FakeServer.Server.Close().

type MockGitilesTransport

type MockGitilesTransport struct {
	Responses map[string]string
}

MockGitilesTransport is a test support type to mock out request/response pairs.

func (MockGitilesTransport) RoundTrip

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

RoundTrip implements http.RoundTripper

Jump to

Keyboard shortcuts

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