tst

package
v0.0.0-...-71c6276 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2023 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllEmpty

func AllEmpty(t assert.TestingT, in ...interface{}) bool

AllEmpty runs test for every item in the slice

func AllFalse

func AllFalse(t assert.TestingT, in ...bool) bool

AllFalse tests every item in parameters

func AllNotEmpty

func AllNotEmpty(t assert.TestingT, in ...interface{}) bool

AllNotEmpty runs test for every item in the slice

func AllTrue

func AllTrue(t assert.TestingT, in ...bool) bool

AllTrue tests every item in parameters

func NewTestHTTPClient

func NewTestHTTPClient(onRequest httpResponder) (httpClient *http.Client)

NewTestHTTPClient returns testing http client which responds with the provided response

tst.NewTestHTTPSequencedClient(func(request *http.request) *http.Response {
  ...
})

func NewTestHTTPSequencedClient

func NewTestHTTPSequencedClient(onRequest ...httpResponder) (httpClient *http.Client)

NewTestHTTPSequencedClient returns testing http client which responds with provided responses in sequence

  tst.NewTestHTTPSequencedClient(
		func(request *http.Request) *http.Response { ... response 1 ... },
		func(request *http.Request) *http.Response { ... response 2 ... }
  )

func TestNetPipe

func TestNetPipe() (result net.Conn, responseChan chan []byte)

TestNetPipe returns net like pipe for testing

Types

type ErrReadCloser

type ErrReadCloser int

ErrReadCloser can be used for testing when reading from body in a request had failed

response = &http.Response{StatusCode: 200, Body: tst.ErrReadCloser(0), Header: make(http.Header)}

func (ErrReadCloser) Close

func (e ErrReadCloser) Close() error

Close implements ReadCloser interface

func (ErrReadCloser) Read

func (e ErrReadCloser) Read(p []byte) (n int, err error)

Read implements ReadCloser interface

Jump to

Keyboard shortcuts

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