testutils

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2021 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cleanup

func Cleanup(t *testing.T, dbConn *gorm.DB)

Cleanup can be run immediately, or deferred with each test run so that we can ensure each case starts with a clean database

func ConnectAndMigrate

func ConnectAndMigrate(t *testing.T) *gorm.DB

ConnectAndMigrate will parse config to attempt to establish a connection to the test database It will cause the test to fail fatally if an error is encountered. It will then attempt to apply all migrations in /db/migrations to that database and will fail similarly if an error is encountered

func SetupTestContext

func SetupTestContext() (*gin.Context, *httptest.ResponseRecorder)

func Truncate

func Truncate(db *gorm.DB) error

Truncate cleans up tables after integration tests

Types

This section is empty.

Jump to

Keyboard shortcuts

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