Documentation ¶
Index ¶
- func CleanupTestDb(db *sqlx.DB) error
- func CountTable(tableName string, db *sqlx.DB) int
- func DropAllTables(db *sqlx.DB) error
- func GetStandardConfig() config.ServiceConfig
- func InitializeDatabase(db *sqlx.DB, migrationsDir, fixturesDir string) error
- func LoadFixtures(db *sqlx.DB, fixturesDirectory string) error
- type DatabaseTestingSuite
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CleanupTestDb ¶
CleanupTestDb truncates tables that are usually populated with fixtures. The set of tables is hardcoded.
func CountTable ¶
CountTable counts all rows in a table. Useful for testing whether a create or delete succeeded.
func DropAllTables ¶
DropAllTables enumerates all tables and drops them.
func GetStandardConfig ¶
func GetStandardConfig() config.ServiceConfig
func InitializeDatabase ¶
InitializeDatabase drops all tables in the provided database, then runs the migrations found in the migrationsDir, then loads the fixtures found in fixturesDir.
Types ¶
type DatabaseTestingSuite ¶
type DatabaseTestingSuite struct { suite.Suite Config *config.ServiceConfig // contains filtered or unexported fields }
func (*DatabaseTestingSuite) AfterTest ¶
func (suite *DatabaseTestingSuite) AfterTest(suiteName, testName string)
func (*DatabaseTestingSuite) BeforeTest ¶
func (suite *DatabaseTestingSuite) BeforeTest(suiteName, testName string)
Perform initialization required by each test function
func (*DatabaseTestingSuite) SetupAllSuite ¶
func (suite *DatabaseTestingSuite) SetupAllSuite()
Perform global setup
Click to show internal directories.
Click to hide internal directories.