fixtures

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2018 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultMongoURL = "127.0.0.1:27017"

DefaultMongoURL is the default Mongo URL for testing

Variables

This section is empty.

Functions

This section is empty.

Types

type Mongo

type Mongo struct {
	suite.Suite

	DBName string
	DB     *mgo.Database
	// contains filtered or unexported fields
}

Mongo is a text fixture for use with github.com/stretchr/testify/suite tests

use it like this:

type MyTests struct {
	*fixtures.Mongo
}

func RunMyTests(t *testing.T) {
	suite.Run(t, &MyTests{Mongo: New(DefaultURL)})
}

func NewMongo

func NewMongo(url string) *Mongo

NewMongo creates a new Mongo test fixture

func (*Mongo) SetupTest

func (m *Mongo) SetupTest()

SetupTest creates a new mongo connection and DB, and attaches it to a session before each test executes

This implements the SetupTestSuite interface

func (*Mongo) TearDownTest

func (m *Mongo) TearDownTest()

TearDownTest drops the database that was created in SetupTest

This implements the TearDownTestSuite interface

Jump to

Keyboard shortcuts

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