testutil

package
v1.36.2 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateMockClient

func CreateMockClient[T any](t *testing.T, createFunc func(*http.Client) T) *T

CreateMockClient is generic because importing the linodego package will result in a cyclic dependency. This pattern isn't ideal but works for now.

func MockRequestBodyValidate

func MockRequestBodyValidate(t *testing.T, expected any, response any) httpmock.Responder

func MockRequestBodyValidateNoBody

func MockRequestBodyValidateNoBody(t *testing.T, response any) httpmock.Responder

func MockRequestURL

func MockRequestURL(path string) *regexp.Regexp

Types

type Logger added in v1.34.0

type Logger interface {
	Errorf(format string, v ...interface{})
	Warnf(format string, v ...interface{})
	Debugf(format string, v ...interface{})
}

type TestLogger added in v1.34.0

type TestLogger struct {
	L *log.Logger
}

func CreateLogger added in v1.34.0

func CreateLogger() *TestLogger

func (*TestLogger) Debugf added in v1.34.0

func (l *TestLogger) Debugf(format string, v ...interface{})

func (*TestLogger) Errorf added in v1.34.0

func (l *TestLogger) Errorf(format string, v ...interface{})

func (*TestLogger) Warnf added in v1.34.0

func (l *TestLogger) Warnf(format string, v ...interface{})

Jump to

Keyboard shortcuts

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