testutils

package
v0.0.49 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthenticateHttpRequest

func AuthenticateHttpRequest(t *testing.T, req *http.Request, user models.User)

func ClearDBTables

func ClearDBTables() error

Method that removes all data from all tables in the database

func CreateRequestWithJSONBody

func CreateRequestWithJSONBody(t *testing.T, url, method string, body interface{}) *http.Request

func SetupDBForTests

func SetupDBForTests() error

SetupDBForTests initializes the database with necessary data for tests

func SetupTestEnvironment

func SetupTestEnvironment(t *testing.T) error

func TeardownTestEnvironment

func TeardownTestEnvironment(t *testing.T) error

func WithSetupAndTearDownTestEnvironment

func WithSetupAndTearDownTestEnvironment(t *testing.T, testFunc func(t *testing.T))

Helper function that wraps a test function with setup and teardown of the test environment The setup is done before calling the test function, it initializes the db and clears its contents The teardown is done after the test function returns, it clears the db contents and closes the db connection If setup or teardown fail, the test will fail immediately

Types

type MockEnqueuer

type MockEnqueuer struct {
	CalledJobs []string
}

func (*MockEnqueuer) Enqueue

func (m *MockEnqueuer) Enqueue(jobName string, args map[string]interface{}) (*work.Job, error)

Jump to

Keyboard shortcuts

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