testutil

package
v0.0.0-...-7eaaaab Latest Latest
Warning

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

Go to latest
Published: May 12, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FatalfFuncDefault = func(format string, v ...interface{}) {}

FatalfFuncDefault .

View Source
var GenerateFuncDefault = func(userID string, duration time.Duration) (string, error) {
	return "", nil
}

GenerateFuncDefault .

View Source
var PrintfFuncDefault = func(format string, v ...interface{}) {}

PrintfFuncDefault .

Functions

func LoadDatabase

func LoadDatabase() (*database.DBW, string)

LoadDatabase will set up the DB and apply migrations for the tests.

func LoadDatabaseFromFile

func LoadDatabaseFromFile(file string, usePrefix bool) (*database.DBW, string)

LoadDatabaseFromFile will set up the DB for the tests.

func SetupDatabase

func SetupDatabase() (*database.DBW, string)

SetupDatabase will create the test database and set the environment variables.

func TeardownDatabase

func TeardownDatabase(unique string)

TeardownDatabase will destroy the test database and unset the environment variables.

Types

type FatalfFuncType

type FatalfFuncType func(format string, v ...interface{})

FatalfFuncType .

type GenerateFuncType

type GenerateFuncType func(userID string, duration time.Duration) (string, error)

GenerateFuncType .

type MockLogger

type MockLogger struct {
	FatalfFunc FatalfFuncType
	PrintfFunc PrintfFuncType
}

MockLogger is a mocked logger.

func (*MockLogger) Fatalf

func (l *MockLogger) Fatalf(format string, v ...interface{})

Fatalf .

func (*MockLogger) Printf

func (l *MockLogger) Printf(format string, v ...interface{})

Printf .

type MockToken

type MockToken struct {
	GenerateFunc GenerateFuncType
}

MockToken is a mocked webtoken.

func (*MockToken) Generate

func (mt *MockToken) Generate(userID string, duration time.Duration) (string, error)

Generate .

type PrintfFuncType

type PrintfFuncType func(format string, v ...interface{})

PrintfFuncType .

Jump to

Keyboard shortcuts

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