Documentation
¶
Overview ¶
Package mocks implements mocks.
Package mocks contains mocks
Index ¶
- Variables
- func NewHTTPClient(code int, body []byte, err error) *http.Client
- type Conn
- func (c *Conn) Close() error
- func (c *Conn) NextReader() (messageType int, r io.Reader, err error)
- func (c *Conn) ReadMessage() (messageType int, p []byte, err error)
- func (c *Conn) SetReadDeadline(t time.Time) error
- func (*Conn) SetReadLimit(limit int64)
- func (c *Conn) SetWriteDeadline(t time.Time) error
- func (c *Conn) WritePreparedMessage(pm *websocket.PreparedMessage) error
- type FailingReader
- type FailingWriter
- type SavingWriter
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrMocked = errors.New("mocked error")
ErrMocked is a mocked error
View Source
var ErrReadFailed = errors.New("Read() failed")
Functions ¶
Types ¶
type Conn ¶
type Conn struct { // CloseResult is the result of Conn.Close CloseResult error // MessageByteArray is the byte array returned by conn.ReadMessage and // conn.NextReader MessageByteArray []byte // NextReaderMessageType is the type returned by conn.NextReader NextReaderMessageType int // NextReaderResult is the result returned by conn.NextReader NextReaderResult error // NextReaderMustFail determines if the Reader's Read() method must fail NextReaderMustFail bool // ReadMessageResult is the result returned by conn.ReadMessage ReadMessageResult error // ReadMessageType is the type returned by conn.ReadMessage ReadMessageType int // SetReadDeadlineResult is the result returned by conn.SetReadDeadline SetReadDeadlineResult error // SetWriteDeadlineResult is the result returned by conn.SetWriteDeadline SetWriteDeadlineResult error // WritePreparedMessageResult is the result returned by conn.WritePreparedMessage WritePreparedMessageResult error }
Conn is a mockable websocket.Conn
func (*Conn) ReadMessage ¶
ReadMessage reads a message from the mocked connection
func (*Conn) SetReadDeadline ¶
SetReadDeadline sets the read deadline of the mocked connection
func (*Conn) SetReadLimit ¶
SetReadLimit sets the read limit of the mocked connection
func (*Conn) SetWriteDeadline ¶
SetWriteDeadline sets the write deadline of the mocked connection
func (*Conn) WritePreparedMessage ¶
func (c *Conn) WritePreparedMessage(pm *websocket.PreparedMessage) error
WritePreparedMessage writes a prepared message on the mocked connection
type FailingReader ¶
type FailingReader struct{}
type SavingWriter ¶
type SavingWriter struct {
Data [][]byte
}
SavingWriter is a writer that saves what it's passed
Click to show internal directories.
Click to hide internal directories.