autopilot

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2021 License: MIT Imports: 9 Imported by: 0

README

autopilot

A golang testing utils library

Go Reference

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Mux    *http.ServeMux
	Server *httptest.Server
)

Functions

func Assert

func Assert(tb testing.TB, condition bool, msg string, v ...interface{})

Assert fails the test if the condition is false.

func Equals

func Equals(tb testing.TB, exp, act interface{})

Equals fails the test if exp is not equal to act.

func Fixture

func Fixture(path string) string

Load testdata/fixtures/<path> and return as string

func NewHttpClient

func NewHttpClient(fn RoundTripFunc) *http.Client

Returns a Mock'd HttpClient

func Ok

func Ok(tb testing.TB, err error)

Ok fails the test if an err is not nil.

func Setup

func Setup() func()

Setup an HttpTestServer and ServerMux (for path routing) and return the teardown function

Types

type RoundTripFunc

type RoundTripFunc func(req *http.Request) *http.Response

func (RoundTripFunc) RoundTrip

func (f RoundTripFunc) RoundTrip(req *http.Request) (*http.Response, error)

Jump to

Keyboard shortcuts

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