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: 0

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