suite

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2025 License: MIT Imports: 10 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

This section is empty.

Types

type BaseSuite

type BaseSuite struct {
	suite.Suite

	// Database
	DB     *sql.DB
	GORMDB *gorm.DB
	SQLXDB *sqlx.DB

	// HTTP Testing
	Router     *gin.Engine
	TestServer *httptest.Server

	// Containers (for integration tests)
	PostgresContainer testcontainers.Container
	RedisContainer    testcontainers.Container

	// Configuration
	TestTenantID string
	TestUserID   string
	TestOrgID    string

	// Cleanup
	CleanupFuncs []func() error

	// Logger
	Logger *logrus.Logger

	// Context
	Ctx    context.Context
	Cancel context.CancelFunc
}

BaseSuite proporciona funcionalidad de testing común para todos los servicios

func (*BaseSuite) AddCleanup

func (s *BaseSuite) AddCleanup(cleanup func() error)

AddCleanup añade una función de cleanup

func (*BaseSuite) AssertError

func (s *BaseSuite) AssertError(err error, msgAndArgs ...interface{})

AssertError verifica que haya error y proporciona contexto

func (*BaseSuite) AssertNoError

func (s *BaseSuite) AssertNoError(err error, msgAndArgs ...interface{})

AssertNoError verifica que no haya error y proporciona contexto

func (*BaseSuite) GetTestServerURL

func (s *BaseSuite) GetTestServerURL() string

GetTestServerURL retorna la URL del servidor de prueba

func (*BaseSuite) RequireDB

func (s *BaseSuite) RequireDB()

RequireDB verifica que la base de datos esté disponible

func (*BaseSuite) RequireRouter

func (s *BaseSuite) RequireRouter()

RequireRouter verifica que el router esté disponible

func (*BaseSuite) SetupSuite

func (s *BaseSuite) SetupSuite()

SetupSuite configura el entorno de testing base

func (*BaseSuite) SetupTest

func (s *BaseSuite) SetupTest()

SetupTest configura cada test individual

func (*BaseSuite) StartTestServer

func (s *BaseSuite) StartTestServer()

StartTestServer inicia un servidor HTTP de prueba

func (*BaseSuite) TearDownSuite

func (s *BaseSuite) TearDownSuite()

TearDownSuite limpia recursos después de todos los tests

func (*BaseSuite) TearDownTest

func (s *BaseSuite) TearDownTest()

TearDownTest limpia después de cada test

func (*BaseSuite) WithOrg

func (s *BaseSuite) WithOrg(orgID string) *BaseSuite

WithOrg configura el organization ID para el test

func (*BaseSuite) WithTenant

func (s *BaseSuite) WithTenant(tenantID string) *BaseSuite

WithTenant configura el tenant ID para el test

func (*BaseSuite) WithUser

func (s *BaseSuite) WithUser(userID string) *BaseSuite

WithUser configura el user ID para el test

Jump to

Keyboard shortcuts

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