testutil

package
v0.0.0-...-d2171c4 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2026 License: EUPL-1.2 Imports: 11 Imported by: 0

Documentation

Overview

Package testutil provides test helpers and fixtures.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewEchoContext

func NewEchoContext(e *echo.Echo, method, path string, body io.Reader) (*echo.Context, *httptest.ResponseRecorder)

NewEchoContext creates an Echo context for handler tests.

func NewEchoContextWithHeaders

func NewEchoContextWithHeaders(e *echo.Echo, method, path string, body io.Reader, headers map[string]string) (*echo.Context, *httptest.ResponseRecorder)

NewEchoContextWithHeaders creates an Echo context with custom headers.

func NewRequest

func NewRequest(method, path string, body io.Reader) *http.Request

NewRequest creates an HTTP request for testing.

func NewTestCredential

func NewTestCredential(t *testing.T, repo *repository.Repository, userID int64, name string) *models.Credential

NewTestCredential creates a test credential for a user.

func NewTestDB

func NewTestDB(t *testing.T) (*bun.DB, *repository.Repository)

NewTestDB creates an in-memory SQLite database for tests. Returns both the database connection and the repository for convenience.

func NewTestUser

func NewTestUser(t *testing.T, repo *repository.Repository, username string) *models.User

NewTestUser creates a test user in the database.

Types

This section is empty.

Jump to

Keyboard shortcuts

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