test

package
v7.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2025 License: AGPL-3.0 Imports: 16 Imported by: ? 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 AssertHTTPStatus

func AssertHTTPStatus(t *testing.T, r *httptest.ResponseRecorder, expectedStatus ...int)

AssertHTTPStatus verifies that the HTTP response status is correct

func DecodeResponse

func DecodeResponse(t *testing.T, r *httptest.ResponseRecorder, target any)

DecodeResponse decodes an HTTP response into a target struct.

func LoadTestFile

func LoadTestFile(t *testing.T, filePath string) (*bytes.Buffer, map[string]string)

LoadTestFile loads a test file from the test/data directory

File contents are returned as a buffer and a map for the HTTP request headers

func Request

func Request(t *testing.T, method, reqURL string, body any, headers ...map[string]string) httptest.ResponseRecorder

Request is a helper method to simplify making a HTTP request for tests.

func TmpFile

func TmpFile(t *testing.T) string

TmpFile returns the path to a unique file to be used in tests

Types

This section is empty.

Jump to

Keyboard shortcuts

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