Documentation
¶
Overview ¶
Package testutil provides test helpers and fixtures.
Index ¶
- func NewEchoContext(e *echo.Echo, method, path string, body io.Reader) (*echo.Context, *httptest.ResponseRecorder)
- func NewEchoContextWithHeaders(e *echo.Echo, method, path string, body io.Reader, headers map[string]string) (*echo.Context, *httptest.ResponseRecorder)
- func NewRequest(method, path string, body io.Reader) *http.Request
- func NewTestCredential(t *testing.T, repo *repository.Repository, userID int64, name string) *models.Credential
- func NewTestDB(t *testing.T) (*bun.DB, *repository.Repository)
- func NewTestUser(t *testing.T, repo *repository.Repository, username string) *models.User
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 ¶
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.
Click to show internal directories.
Click to hide internal directories.