test

package
v0.0.0-...-b0a70a3 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CaptureStdout

func CaptureStdout(f func()) string

func MockHttpServer

func MockHttpServer(t *testing.T, requests []Request) *server

MockHttpServer creates a test server which will send responses in the given order It is possible to check on Method and Uri if set Responses can contain JSON-encoded body if ResponseBody is set

func MockHttpServerStatus

func MockHttpServerStatus(t *testing.T, statusCode ...int) *server

MockHttpServerStatus creates a test server which will send empty responses with the given status code the responses which will be sent are in the given order

Types

type Request

type Request struct {
	Method             string
	Uri                string
	ResponseStatusCode int
	ResponseBody       interface{}
}

Jump to

Keyboard shortcuts

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