testutil

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2026 License: AGPL-3.0 Imports: 15 Imported by: 0

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

Jump to

Keyboard shortcuts

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