testingsuite

package
v0.0.0-...-34c5031 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StringWithCharset

func StringWithCharset(length int, charset string) string

StringWithCharset returns a random string https://www.calhoun.io/creating-random-strings-in-go/

Types

type BaseTestSuite

type BaseTestSuite struct {
	suite.Suite
}

BaseTestSuite is a suite for testing

func (*BaseTestSuite) FatalFalse

func (suite *BaseTestSuite) FatalFalse(b bool, messages ...string)

FatalFalse ends a test if a value is not false

func (*BaseTestSuite) FatalNil

func (suite *BaseTestSuite) FatalNil(object interface{}, messages ...string)

FatalNil ends a test if an object is not nil

func (*BaseTestSuite) FatalNoError

func (suite *BaseTestSuite) FatalNoError(err error, messages ...string)

FatalNoError ends a test if an error is not nil

type PackageName

type PackageName string

PackageName represents the project-relative name of a Go package.

func CurrentPackage

func CurrentPackage() PackageName

CurrentPackage returns the project-relative name of the caller's package.

"github.com/transcom/milmove_orders/pkg/" is removed from the beginning of the absolute package name, so the return value will be e.g. "handlers/internalapi".

func (PackageName) String

func (pn PackageName) String() string

func (PackageName) Suffix

func (pn PackageName) Suffix(suffix string) PackageName

Suffix returns a new PackageName with an underscore and the suffix appended to the end suffix should be a snake case string

type PopTestSuite

type PopTestSuite struct {
	BaseTestSuite
	PackageName
	// contains filtered or unexported fields
}

PopTestSuite is a suite for testing

func NewPopTestSuite

func NewPopTestSuite(packageName PackageName) PopTestSuite

NewPopTestSuite returns a new PopTestSuite

func (*PopTestSuite) DB

func (suite *PopTestSuite) DB() *pop.Connection

DB returns a db connection

func (*PopTestSuite) MustCreate

func (suite *PopTestSuite) MustCreate(db *pop.Connection, model interface{})

MustCreate requires creating without errors

func (*PopTestSuite) MustDestroy

func (suite *PopTestSuite) MustDestroy(model interface{})

MustDestroy requires deleting without errors

func (*PopTestSuite) MustSave

func (suite *PopTestSuite) MustSave(model interface{})

MustSave requires saving without errors

func (*PopTestSuite) NoVerrs

func (suite *PopTestSuite) NoVerrs(verrs *validate.Errors) bool

NoVerrs prints any errors it receives

func (*PopTestSuite) TearDown

func (suite *PopTestSuite) TearDown()

TearDown runs the teardown for step for the suite Important steps are to close open DB connections and drop the DB

Jump to

Keyboard shortcuts

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