assert

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertAjaxResponse

func AssertAjaxResponse(t *testing.T, w *httptest.ResponseRecorder, status int)

AssertAjaxResponse asserts that the response is an Ajax partial response. Checks for appropriate headers and partial HTML content.

func AssertBodyContains

func AssertBodyContains(t *testing.T, w *httptest.ResponseRecorder, substring string)

AssertBodyContains asserts that the HTTP response body contains the expected substring.

func AssertBodyNotContains

func AssertBodyNotContains(t *testing.T, w *httptest.ResponseRecorder, substring string)

AssertBodyNotContains asserts that the HTTP response body does not contain the substring.

func AssertHTMLResponse

func AssertHTMLResponse(t *testing.T, w *httptest.ResponseRecorder, status int, contains string)

AssertHTMLResponse asserts that the HTTP response has the expected status code and contains the expected HTML content.

func AssertHeader

func AssertHeader(t *testing.T, w *httptest.ResponseRecorder, header, expectedValue string)

AssertHeader asserts that the HTTP response has the expected header value.

func AssertJSONResponse

func AssertJSONResponse(t *testing.T, w *httptest.ResponseRecorder, status int, expectedJSON string)

AssertJSONResponse asserts that the HTTP response has the expected status code, content type, and JSON body.

func AssertRedirect

func AssertRedirect(t *testing.T, w *httptest.ResponseRecorder, expectedLocation string)

AssertRedirect asserts that the response is a redirect to the expected location.

func AssertStatusCode

func AssertStatusCode(t *testing.T, w *httptest.ResponseRecorder, expectedStatus int)

AssertStatusCode asserts that the HTTP response has the expected status code.

func AssertTextResponse

func AssertTextResponse(t *testing.T, w *httptest.ResponseRecorder, status int, expectedText string)

AssertTextResponse asserts that the HTTP response has the expected status code and text body.

func RequireHeader

func RequireHeader(t *testing.T, w *httptest.ResponseRecorder, header, expectedValue string)

RequireHeader requires that the HTTP response has the expected header value. Fails the test immediately if the header doesn't match.

func RequireStatusCode

func RequireStatusCode(t *testing.T, w *httptest.ResponseRecorder, expectedStatus int)

RequireStatusCode requires that the HTTP response has the expected status code. Fails the test immediately if the status code doesn't match.

Types

This section is empty.

Jump to

Keyboard shortcuts

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