tests

package
v0.0.0-...-faaee1e Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package tests contains supporting code for running tests.

Index

Constants

View Source
const (
	Success = "\u2713"
	Failed  = "\u2717"
)

Success and failure markers.

Variables

View Source
var (
	AdminID = "32bc1165-24t2-61a7-af3e-9da4agf2h1p1"
	UserID  = "14hg2372-66e5-34e9-jl8d-6ga1tuf7l3r4"
)

Configs for running tests.

Functions

func Context

func Context() context.Context

Context returns an app level context for testing.

func IntPointer

func IntPointer(i int) *int

IntPointer is a helper to get a *int from a int for helping on running tests.

func NewUnit

func NewUnit(t *testing.T) (*zap.SugaredLogger, *sqlx.DB, func())

NewUnit creates a test database. It sets the proper db migrations. It returns the logger, the database and a teardown function.

func StringPointer

func StringPointer(s string) *string

StringPointer is a helper to get a *string from a string for helping on running tests.

Types

type Test

type Test struct {
	TraceID  string
	DB       *sqlx.DB
	Log      *zap.SugaredLogger
	Auth     *auth.Auth
	KID      string
	Teardown func()
	// contains filtered or unexported fields
}

Test owns state for running and shutting down integration tests.

func NewIntegration

func NewIntegration(t *testing.T) *Test

NewIntegration creates a database, seeds it, constructs an authenticator.

func (*Test) Token

func (test *Test) Token(email, pass string) string

Token generates an authenticated token.

Jump to

Keyboard shortcuts

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