Documentation ¶
Index ¶
- type MockAddr
- type MockFile
- type MockHTTPWriter
- type MockTLSConnection
- func (m *MockTLSConnection) Close() error
- func (m *MockTLSConnection) LocalAddr() net.Addr
- func (m *MockTLSConnection) Read(b []byte) (n int, err error)
- func (m *MockTLSConnection) RemoteAddr() net.Addr
- func (m *MockTLSConnection) SetDeadline(t time.Time) error
- func (m *MockTLSConnection) SetReadDeadline(t time.Time) error
- func (m *MockTLSConnection) SetWriteDeadline(t time.Time) error
- func (m *MockTLSConnection) Write(b []byte) (n int, err error)
- type MockWriteReader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MockAddr ¶
type MockAddr struct { Ntwrk string // name of the network (for example, "tcp", "udp") Str string // string form of address (for example, "192.0.2.1:25", "[2001:db8::1]:80") }
MockAddr mocks net.Addr
type MockHTTPWriter ¶
MockHTTPWriter is meant to implement http.ResponseWriter interface. It can be useful in various test cases with RESTful API methods that do not return any value to external function but write output directly to HTTP client
func (*MockHTTPWriter) AssertAndFlush ¶
func (m *MockHTTPWriter) AssertAndFlush(t *testing.T, assertWith interface{})
AssertAndFlush uses assert.Equal() to check if current buffer data equals to given example and then cleans buffer.
func (*MockHTTPWriter) Flush ¶
func (m *MockHTTPWriter) Flush()
func (*MockHTTPWriter) Header ¶
func (m *MockHTTPWriter) Header() http.Header
Header returns http.Header in case it was set before or just nil map in other cases
func (*MockHTTPWriter) Write ¶
func (m *MockHTTPWriter) Write(b []byte) (int, error)
Write writes to mock's internal buffer
func (*MockHTTPWriter) WriteHeader ¶
func (m *MockHTTPWriter) WriteHeader(statusCode int)
WriteHeader sets mocks internal status code
type MockTLSConnection ¶
type MockTLSConnection struct { MWR MockWriteReader AskedToBeClosed bool LocAddr net.Addr RemAddr net.Addr }
MockTLSConnection mocks net.Conn interface
func (*MockTLSConnection) Close ¶
func (m *MockTLSConnection) Close() error
func (*MockTLSConnection) LocalAddr ¶
func (m *MockTLSConnection) LocalAddr() net.Addr
func (*MockTLSConnection) RemoteAddr ¶
func (m *MockTLSConnection) RemoteAddr() net.Addr
func (*MockTLSConnection) SetDeadline ¶
func (m *MockTLSConnection) SetDeadline(t time.Time) error
func (*MockTLSConnection) SetReadDeadline ¶
func (m *MockTLSConnection) SetReadDeadline(t time.Time) error
func (*MockTLSConnection) SetWriteDeadline ¶
func (m *MockTLSConnection) SetWriteDeadline(t time.Time) error
type MockWriteReader ¶
type MockWriteReader struct { Bytes []byte ReturnEOF bool //FIle will return EOF at once DontReturEOFEver bool // contains filtered or unexported fields }
func (*MockWriteReader) Close ¶
func (l *MockWriteReader) Close() error
func (*MockWriteReader) SetLastRead ¶
func (l *MockWriteReader) SetLastRead(n int)
func (*MockWriteReader) WriteString ¶
func (l *MockWriteReader) WriteString(s string) (n int, err error)
Click to show internal directories.
Click to hide internal directories.