testutils

package module
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2025 License: MIT Imports: 7 Imported by: 0

README

testutils

godoc

Testing utilities

Authors

  • Christophe Lambin

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

Documentation

Overview

Package testutils contains candidates to be moved to go-common/testutils

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Eventually

func Eventually(f func() bool, timeout time.Duration, interval time.Duration) bool

func Panics

func Panics(f func()) bool

Types

type PathResponse added in v0.7.0

type PathResponse map[string]Response

type Response added in v0.7.0

type Response struct {
	Body       any
	StatusCode int
}

type Responses added in v0.7.0

type Responses map[string]PathResponse

type TestServer

type TestServer struct {
	Responses Responses
	// contains filtered or unexported fields
}

func (*TestServer) Calls

func (t *TestServer) Calls() map[string]int

Calls returns how many requests were accepted for each path.

func (*TestServer) ServeHTTP

func (t *TestServer) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*TestServer) TotalCalls

func (t *TestServer) TotalCalls() int

TotalCalls returns how many requests were accepted for all paths.

Jump to

Keyboard shortcuts

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