Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HTTPClientMock ¶
type HTTPClientMock struct { // DoFunc mocks the Do method. DoFunc func(req *http.Request) (*http.Response, error) // contains filtered or unexported fields }
HTTPClientMock is a mock implementation of lib.HTTPClient.
func TestSomethingThatUsesHTTPClient(t *testing.T) { // make and configure a mocked lib.HTTPClient mockedHTTPClient := &HTTPClientMock{ DoFunc: func(req *http.Request) (*http.Response, error) { panic("mock out the Do method") }, } // use mockedHTTPClient in code that requires lib.HTTPClient // and then make assertions. }
func (*HTTPClientMock) DoCalls ¶
func (mock *HTTPClientMock) DoCalls() []struct { Req *http.Request }
DoCalls gets all the calls that were made to Do. Check the length with:
len(mockedHTTPClient.DoCalls())
type SampleUpdaterMock ¶
type SampleUpdaterMock struct { // AppendFunc mocks the Append method. AppendFunc func(msg string) error // ReaderFunc mocks the Reader method. ReaderFunc func() (io.ReadCloser, error) // contains filtered or unexported fields }
SampleUpdaterMock is a mock implementation of lib.SampleUpdater.
func TestSomethingThatUsesSampleUpdater(t *testing.T) { // make and configure a mocked lib.SampleUpdater mockedSampleUpdater := &SampleUpdaterMock{ AppendFunc: func(msg string) error { panic("mock out the Append method") }, ReaderFunc: func() (io.ReadCloser, error) { panic("mock out the Reader method") }, } // use mockedSampleUpdater in code that requires lib.SampleUpdater // and then make assertions. }
func (*SampleUpdaterMock) Append ¶
func (mock *SampleUpdaterMock) Append(msg string) error
Append calls AppendFunc.
func (*SampleUpdaterMock) AppendCalls ¶
func (mock *SampleUpdaterMock) AppendCalls() []struct { Msg string }
AppendCalls gets all the calls that were made to Append. Check the length with:
len(mockedSampleUpdater.AppendCalls())
func (*SampleUpdaterMock) Reader ¶
func (mock *SampleUpdaterMock) Reader() (io.ReadCloser, error)
Reader calls ReaderFunc.
func (*SampleUpdaterMock) ReaderCalls ¶
func (mock *SampleUpdaterMock) ReaderCalls() []struct { }
ReaderCalls gets all the calls that were made to Reader. Check the length with:
len(mockedSampleUpdater.ReaderCalls())
Click to show internal directories.
Click to hide internal directories.