Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HTTPServerMock ¶
type HTTPServerMock struct {
// ListenAndServeFunc mocks the ListenAndServe method.
ListenAndServeFunc func() error
// ShutdownFunc mocks the Shutdown method.
ShutdownFunc func(ctx context.Context) error
// contains filtered or unexported fields
}
HTTPServerMock is a mock implementation of files.HTTPServer.
func TestSomethingThatUsesHTTPServer(t *testing.T) {
// make and configure a mocked files.HTTPServer
mockedHTTPServer := &HTTPServerMock{
ListenAndServeFunc: func() error {
panic("mock out the ListenAndServe method")
},
ShutdownFunc: func(ctx context.Context) error {
panic("mock out the Shutdown method")
},
}
// use mockedHTTPServer in code that requires files.HTTPServer
// and then make assertions.
}
func (*HTTPServerMock) ListenAndServe ¶
func (mock *HTTPServerMock) ListenAndServe() error
ListenAndServe calls ListenAndServeFunc.
func (*HTTPServerMock) ListenAndServeCalls ¶
func (mock *HTTPServerMock) ListenAndServeCalls() []struct { }
ListenAndServeCalls gets all the calls that were made to ListenAndServe. Check the length with:
len(mockedHTTPServer.ListenAndServeCalls())
func (*HTTPServerMock) Shutdown ¶
func (mock *HTTPServerMock) Shutdown(ctx context.Context) error
Shutdown calls ShutdownFunc.
func (*HTTPServerMock) ShutdownCalls ¶
func (mock *HTTPServerMock) ShutdownCalls() []struct { Ctx context.Context }
ShutdownCalls gets all the calls that were made to Shutdown. Check the length with:
len(mockedHTTPServer.ShutdownCalls())
Click to show internal directories.
Click to hide internal directories.