testutil

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: AGPL-3.0 Imports: 15 Imported by: 0 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 CleanupTestDB

func CleanupTestDB(t *testing.T, db *sql.DB)

func CreateTestPasswordResetToken

func CreateTestPasswordResetToken(userID uuid.UUID, tokenHash string) *models.PasswordResetToken

func CreateTestRefreshToken

func CreateTestRefreshToken(userID uuid.UUID, tokenHash string) *models.RefreshToken

func CreateTestUser

func CreateTestUser(email, name, passwordHash string) *models.User

func SetupTestDB

func SetupTestDB(t *testing.T) *sql.DB

func TeardownTestDB

func TeardownTestDB(t *testing.T, db *sql.DB)

Types

type APITestClient

type APITestClient struct {
	Router *gin.Engine
	T      *testing.T
	Token  string
}

func NewAPITestClient

func NewAPITestClient(t *testing.T, router *gin.Engine) *APITestClient

func (*APITestClient) DELETE

func (c *APITestClient) DELETE(path string) *httptest.ResponseRecorder

func (*APITestClient) GET

func (*APITestClient) PATCH

func (c *APITestClient) PATCH(path string, body interface{}) *httptest.ResponseRecorder

func (*APITestClient) POST

func (c *APITestClient) POST(path string, body interface{}) *httptest.ResponseRecorder

func (*APITestClient) PUT

func (c *APITestClient) PUT(path string, body interface{}) *httptest.ResponseRecorder

func (*APITestClient) ParseJSON

func (c *APITestClient) ParseJSON(w *httptest.ResponseRecorder, target interface{})

func (*APITestClient) SetAuthToken

func (c *APITestClient) SetAuthToken(token string)

type TestDBConfig

type TestDBConfig struct {
	Host     string
	Port     string
	User     string
	Password string
	DBName   string
}

func DefaultTestDBConfig

func DefaultTestDBConfig() TestDBConfig

Directories

Path Synopsis
Package restorefake is an in-memory repository.RestoreStore for tests.
Package restorefake is an in-memory repository.RestoreStore for tests.

Jump to

Keyboard shortcuts

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