testutils

package
v0.0.0-...-f23cc3b Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2025 License: MIT Imports: 7 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 AssertEqual

func AssertEqual(t *testing.T, got, want interface{})

AssertEqual checks if two values are equal

func AssertError

func AssertError(t *testing.T, err error, wantErr bool, expectedCode string)

AssertError checks if an error is of the expected type and code

func AssertFalse

func AssertFalse(t *testing.T, condition bool, message string)

AssertFalse checks if a condition is false

func AssertInvalidToken

func AssertInvalidToken(t *testing.T, auth *authkit.AuthKit, token string, expectedErrorCode string)

AssertInvalidToken validates that a token is invalid

func AssertJWTClaims

func AssertJWTClaims(t *testing.T, claims *contracts.Claims, expectedIssuer string, expectedAudience []string)

AssertJWTClaims validates specific JWT claims

func AssertNoError

func AssertNoError(t *testing.T, err error)

AssertNoError is a helper that fails the test if err is not nil

func AssertNotEmpty

func AssertNotEmpty(t *testing.T, value, fieldName string)

AssertNotEmpty checks if a string is not empty

func AssertTokenGeneration

func AssertTokenGeneration(t *testing.T, auth *authkit.AuthKit, user *contracts.User) string

AssertTokenGeneration generates a token and validates its basic properties

func AssertTrue

func AssertTrue(t *testing.T, condition bool, message string)

AssertTrue checks if a condition is true

func AssertValidToken

func AssertValidToken(t *testing.T, auth *authkit.AuthKit, token string, expectedUserID string) *contracts.Claims

AssertValidToken validates that a token is valid and contains expected claims

func SetupTestAuth

func SetupTestAuth(t *testing.T, opts ...authkit.Option) *authkit.AuthKit

SetupTestAuth creates a test AuthKit instance with sensible defaults

func TestAPIKey

func TestAPIKey(id, userID string) *contracts.APIKey

TestAPIKey creates a test API key

func TestClaims

func TestClaims(subject, issuer string) *contracts.Claims

TestClaims creates test claims

func TestUser

func TestUser(id string) *contracts.User

TestUser creates a test user with default values

func TestUserWithRoles

func TestUserWithRoles(id string, roles []string) *contracts.User

TestUserWithRoles creates a test user with specific roles

Types

This section is empty.

Jump to

Keyboard shortcuts

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