mocks

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BurstLimiterMock added in v0.7.0

type BurstLimiterMock struct {
	rate.Limiter

	OnBurst func() uint64
	OnTakeN func(n uint64) rate.Token
}

func (BurstLimiterMock) Burst added in v0.7.0

func (m BurstLimiterMock) Burst() uint64

func (BurstLimiterMock) TakeN added in v0.7.0

func (m BurstLimiterMock) TakeN(n uint64) rate.Token

type CookiesJar added in v0.4.0

type CookiesJar struct {
	OnSetCookies func(u *url.URL, cookies []*http.Cookie)
	OnCookies    func(u *url.URL) []*http.Cookie
}

func (*CookiesJar) Cookies added in v0.4.0

func (j *CookiesJar) Cookies(u *url.URL) []*http.Cookie

func (*CookiesJar) SetCookies added in v0.4.0

func (j *CookiesJar) SetCookies(u *url.URL, cookies []*http.Cookie)

type LimiterMock added in v0.7.0

type LimiterMock struct {
	OnLimit  func() uint64
	OnTokens func() uint64
	OnTake   func() rate.Token
}

func (LimiterMock) Limit added in v0.7.0

func (m LimiterMock) Limit() uint64

func (LimiterMock) Take added in v0.7.0

func (m LimiterMock) Take() rate.Token

func (LimiterMock) Tokens added in v0.7.0

func (m LimiterMock) Tokens() uint64

type LimiterStoreMock added in v0.7.0

type LimiterStoreMock struct {
	OnLimit func(key string) rate.Limiter
}

func (LimiterStoreMock) Limit added in v0.7.0

func (m LimiterStoreMock) Limit(key string) rate.Limiter

type ResponseWriter added in v0.4.0

type ResponseWriter struct {
	OnHeader      func() http.Header
	OnWrite       func([]byte) (int, error)
	OnWriteHeader func(int)
	OnResponse    func(int, interface{}) error
}

func (*ResponseWriter) Header added in v0.4.0

func (w *ResponseWriter) Header() http.Header

func (*ResponseWriter) Response added in v0.4.0

func (w *ResponseWriter) Response(code int, data interface{}) error

func (*ResponseWriter) Write added in v0.4.0

func (w *ResponseWriter) Write(b []byte) (int, error)

func (*ResponseWriter) WriteHeader added in v0.4.0

func (w *ResponseWriter) WriteHeader(statusCode int)

type RoundTripper added in v0.4.0

type RoundTripper struct {
	OnRoundTrip func(*http.Request) (*http.Response, error)
}

func (*RoundTripper) RoundTrip added in v0.4.0

func (rt *RoundTripper) RoundTrip(r *http.Request) (*http.Response, error)

type Stringer

type Stringer struct {
	Value string
}

func (Stringer) GoString

func (s Stringer) GoString() string

func (Stringer) String

func (s Stringer) String() string

type TokenMock added in v0.7.0

type TokenMock struct {
	OnAllow    func() bool
	OnResetsAt func() time.Time
	OnUse      func() error
	OnCancel   func()
}

func (TokenMock) Allow added in v0.7.0

func (m TokenMock) Allow() bool

func (TokenMock) Cancel added in v0.7.0

func (m TokenMock) Cancel()

func (TokenMock) ResetsAt added in v0.7.0

func (m TokenMock) ResetsAt() time.Time

func (TokenMock) Use added in v0.7.0

func (m TokenMock) Use() error

type Writer

type Writer struct {
	// contains filtered or unexported fields
}

func NewWriterMock

func NewWriterMock(writeFn func(p []byte) (n int, err error)) *Writer

func (*Writer) Write

func (m *Writer) Write(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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