testutil

package
v3.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2026 License: MIT Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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 CreateMockClientWithError

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

CreateMockClientWithError 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

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

type TestLogger

type TestLogger struct {
	L *log.Logger
}

func CreateLogger

func CreateLogger() *TestLogger

func (*TestLogger) Debugf

func (l *TestLogger) Debugf(format string, v ...any)

func (*TestLogger) Errorf

func (l *TestLogger) Errorf(format string, v ...any)

func (*TestLogger) Warnf

func (l *TestLogger) Warnf(format string, v ...any)

Jump to

Keyboard shortcuts

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