mocks

package
v3.4.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2020 License: EPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateErrorResponse

func GenerateErrorResponse(body string, statusCode int) (*http.Response, func() bool)

GenerateErrorResponse generates a mocked *http.Response and returns a function that allows checking if the body of the response has been closed. The body will throw and error when read.

func GenerateResponse

func GenerateResponse(body string, statusCode int, header http.Header) (*http.Response, func() bool)

GenerateResponse generates a mocked *http.Response and returns a function that allows checking if this response's body has been closed.

func NewTestHTTPClient

func NewTestHTTPClient(response *http.Response, err error) *http.Client

Types

type IoUtil

type IoUtil struct {
	mock.Mock
}

IoUtil is an autogenerated mock type for the IoUtil type

func (*IoUtil) CopyFile

func (_m *IoUtil) CopyFile(src string, dest string) error

CopyFile provides a mock function with given fields: src, dest

func (*IoUtil) CopyResource

func (_m *IoUtil) CopyResource(src string, dest string) error

CopyResource provides a mock function with given fields: src, dest

func (*IoUtil) CreateFile

func (_m *IoUtil) CreateFile(file string, tr io.Reader) error

CreateFile provides a mock function with given fields: file, tr

func (*IoUtil) Download

func (_m *IoUtil) Download(URL string, destPath string, useContentDisposition bool) (string, error)

Download provides a mock function with given fields: URL, destPath, useContentDisposition

func (*IoUtil) Fetch

func (_m *IoUtil) Fetch(url string) ([]byte, error)

Fetch provides a mock function with given fields: url

func (*IoUtil) FileExists

func (_m *IoUtil) FileExists(path string) bool

FileExists provides a mock function with given fields: path

func (*IoUtil) GetFilesByGlob

func (_m *IoUtil) GetFilesByGlob(glob string) ([]string, error)

GetFilesByGlob provides a mock function with given fields: glob

func (*IoUtil) MkDir

func (_m *IoUtil) MkDir(_a0 string) error

MkDir provides a mock function with given fields: _a0

func (*IoUtil) ReadFile

func (_m *IoUtil) ReadFile(path string) ([]byte, error)

ReadFile provides a mock function with given fields: path

func (*IoUtil) RemoveAll

func (_m *IoUtil) RemoveAll(path string) error

RemoveAll provides a mock function with given fields: path

func (*IoUtil) RemoveFile

func (_m *IoUtil) RemoveFile(path string) error

RemoveFile provides a mock function with given fields: path

func (*IoUtil) ResolveDestPath

func (_m *IoUtil) ResolveDestPath(filePath string, destDir string) string

ResolveDestPath provides a mock function with given fields: filePath, destDir

func (*IoUtil) ResolveDestPathFromURL

func (_m *IoUtil) ResolveDestPathFromURL(url string, destDir string) string

ResolveDestPathFromURL provides a mock function with given fields: url, destDir

func (*IoUtil) TempDir

func (_m *IoUtil) TempDir(_a0 string, _a1 string) (string, error)

TempDir provides a mock function with given fields: _a0, _a1

func (*IoUtil) Untar

func (_m *IoUtil) Untar(tarPath string, dest string) error

Untar provides a mock function with given fields: tarPath, dest

func (*IoUtil) Unzip

func (_m *IoUtil) Unzip(arch string, dest string) error

Unzip provides a mock function with given fields: arch, dest

func (*IoUtil) WriteFile

func (_m *IoUtil) WriteFile(path string, data []byte) error

WriteFile provides a mock function with given fields: path, data

type MockResponseBodyImpl

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

MockResponseBodyImpl is an implementation of MockResponseBody

func (MockResponseBodyImpl) Close

func (body MockResponseBodyImpl) Close() error

Close simply sets body.isClosed to true. Useful for checking that response body is closed.

func (MockResponseBodyImpl) IsClosed

func (body MockResponseBodyImpl) IsClosed() bool

IsClosed returns whether or not Close has been called on this body.

func (MockResponseBodyImpl) Read

func (body MockResponseBodyImpl) Read(p []byte) (n int, err error)

Read wraps the internal reader's read method.

type MockRoundTripper

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

func (MockRoundTripper) RoundTrip

func (m MockRoundTripper) 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