mocks

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2024 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package mocks contains mocks for standard library types.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

type Conn struct {
	// MockRead is the function to call when Read is called.
	MockRead func(b []byte) (int, error)

	// MockWrite is the function to call when Write is called.
	MockWrite func(b []byte) (int, error)

	// MockClose is the function to call when Close is called.
	MockClose func() error

	// MockLocalAddr is the function to call when LocalAddr is called.
	MockLocalAddr func() net.Addr

	// MockRemoteAddr is the function to call when RemoteAddr is called.
	MockRemoteAddr func() net.Addr

	// MockSetDeadline is the function to call when SetDeadline is called.
	MockSetDeadline func(t time.Time) error

	// MockSetReadDeadline is the function to call when SetReadDeadline is called.
	MockSetReadDeadline func(t time.Time) error

	// MockSetWriteDeadline is the function to call when SetWriteDeadline is called.
	MockSetWriteDeadline func(t time.Time) error
}

Conn is a mockable net.Conn.

func (*Conn) Close

func (c *Conn) Close() error

Close calls MockClose.

func (*Conn) LocalAddr

func (c *Conn) LocalAddr() net.Addr

LocalAddr calls MockLocalAddr.

func (*Conn) Read

func (c *Conn) Read(b []byte) (int, error)

Read calls MockRead.

func (*Conn) RemoteAddr

func (c *Conn) RemoteAddr() net.Addr

RemoteAddr calls MockRemoteAddr.

func (*Conn) SetDeadline

func (c *Conn) SetDeadline(t time.Time) error

SetDeadline calls MockSetDeadline.

func (*Conn) SetReadDeadline

func (c *Conn) SetReadDeadline(t time.Time) error

SetReadDeadline calls MockSetReadDeadline.

func (*Conn) SetWriteDeadline

func (c *Conn) SetWriteDeadline(t time.Time) error

SetWriteDeadline calls MockSetWriteDeadline.

func (*Conn) Write

func (c *Conn) Write(b []byte) (int, error)

Write calls MockWrite.

type HTTPTransport

type HTTPTransport struct {
	// MockRoundTrip is the function to call when RoundTrip is called.
	MockRoundTrip func(req *http.Request) (*http.Response, error)
}

HTTPTransport mocks http.RoundTripper.

func (*HTTPTransport) RoundTrip

func (txp *HTTPTransport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip calls MockRoundTrip.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL