mocks

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2018 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultTestServer

func DefaultTestServer() *httptest.Server

DefaultTestServer creates a new http server

func MockHTTPClient

func MockHTTPClient(url string) api.Client

MockHTTPClient mocks an http client

Types

type MockAPIRequest

type MockAPIRequest struct {
	StatusCode int
	// contains filtered or unexported fields
}

MockAPIRequest implements the api.Request interface used for testing

func MakeMockAPIRequest

func MakeMockAPIRequest(data *os.File, code int) MockAPIRequest

MakeMockAPIRequest creates and returns a MockAPIRequest data is a file pointer to the data to return for the request code is the status code that should be returned for the request

func (MockAPIRequest) Delete

func (r MockAPIRequest) Delete(endpoint string) (*http.Response, error)

Delete returns a mocked http response

func (MockAPIRequest) Get

func (r MockAPIRequest) Get(endpoint string) (*http.Response, error)

Get returns a mocked http response

func (MockAPIRequest) MakeRequest

func (r MockAPIRequest) MakeRequest(method string, url string, body string) (*http.Request, error)

MakeRequest returns a mocked http request

func (MockAPIRequest) Post

func (r MockAPIRequest) Post(endpoint string, data interface{}) (*http.Response, error)

Post returns a mocked http response

Jump to

Keyboard shortcuts

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