testutil

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2025 License: MIT 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 AssertContains

func AssertContains(t *testing.T, recorder *httptest.ResponseRecorder, expected string)

AssertContains asserts that the response body contains the expected string.

func AssertHTTPStatus

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

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

func AssertNotContains

func AssertNotContains(t *testing.T, recorder *httptest.ResponseRecorder, unexpected string)

AssertNotContains asserts that the response body does not contain the string.

func Base64DecodeSAML

func Base64DecodeSAML(encoded string) ([]byte, error)

Base64DecodeSAML decodes base64 encoded SAML data.

func Base64EncodeSAML

func Base64EncodeSAML(data []byte) string

Base64EncodeSAML encodes SAML data to base64 (standard encoding).

func CompressData

func CompressData(data []byte) ([]byte, error)

CompressData compresses data using deflate algorithm (for SAML HTTP-Redirect binding).

func CreateTestAuthRequest

func CreateTestAuthRequest(issuer string) *crewjamsaml.AuthnRequest

CreateTestAuthRequest creates a basic SAML authentication request for testing.

func CreateTestHTTPRequest

func CreateTestHTTPRequest(method, path string, params map[string]string) *http.Request

CreateTestHTTPRequest creates a test HTTP request with common SAML parameters.

func CreateTestLogoutRequest

func CreateTestLogoutRequest(issuer, nameID string) *crewjamsaml.LogoutRequest

CreateTestLogoutRequest creates a basic SAML logout request for testing.

func CreateTestLogoutRequestWithTime

func CreateTestLogoutRequestWithTime(issuer, nameID string, issueInstant time.Time) *crewjamsaml.LogoutRequest

CreateTestLogoutRequestWithTime creates a SAML logout request with specific issue instant.

func CreateTestRecorder

func CreateTestRecorder() *httptest.ResponseRecorder

CreateTestRecorder creates a new httptest.ResponseRecorder.

func GenerateTestCertificate

func GenerateTestCertificate(t *testing.T, commonName string) (*x509.Certificate, *rsa.PrivateKey)

GenerateTestCertificate creates a test certificate and private key.

func GenerateTestCertificatePEM

func GenerateTestCertificatePEM(t *testing.T, commonName string) ([]byte, []byte)

GenerateTestCertificatePEM creates a test certificate and private key in PEM format.

Types

This section is empty.

Jump to

Keyboard shortcuts

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