test

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertFileContains

func AssertFileContains(t *testing.T, path, content string)

AssertFileContains asserts that the file at the given path exists and contains the given content.

func GetSha256Integrity

func GetSha256Integrity(content string) string

func HttpHandler

func HttpHandler(handler http.HandlerFunc) (int, *httptest.Server)

func TestHttpHandler

func TestHttpHandler(content string, t *testing.T) int

TestHttpHandler creates a new HTTP server and returns the port and serves the given content. Its lifetime is tied to the given testing.T object.

func TestHttpHandlerWithServer

func TestHttpHandlerWithServer(content string, t *testing.T) (int, *httptest.Server)

func TmpDir

func TmpDir(t *testing.T) string

func TmpFile

func TmpFile(t *testing.T, content string) string

Types

type RecordedRequest

type RecordedRequest struct {
	Method  string
	Url     string
	Body    []byte
	Headers map[string][]string
}

func NewRecordedRequest

func NewRecordedRequest(r *http.Request) *RecordedRequest

type RecorderHttpServer

type RecorderHttpServer struct {
	*httptest.Server
	Requests *[]RecordedRequest
}

func NewRecorderHttpServer

func NewRecorderHttpServer(handler http.HandlerFunc, t *testing.T) (*RecorderHttpServer, int)

Jump to

Keyboard shortcuts

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