test

package
v0.0.0-...-42225ac Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2017 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Overview

This file was generated by counterfeiter

Index

Constants

This section is empty.

Variables

View Source
var TestIdentity = account.Identity{
	ID:       uuid.NewV4(),
	Username: "TestDeveloper",
	User:     TestUser,
}

TestIdentity only creates in memory obj for testing purposes

View Source
var TestIdentity2 = account.Identity{
	ID:       uuid.NewV4(),
	Username: "TestDeveloper2",
	User:     TestUser2,
}

TestIdentity2 only creates in memory obj for testing purposes

View Source
var TestObserverIdentity = account.Identity{
	ID:       uuid.NewV4(),
	Username: "TestObserver",
	User:     TestUser,
}

TestObserverIdentity only creates in memory obj for testing purposes

View Source
var TestOversizedNameObj = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
View Source
var TestUser = account.User{
	ID:       uuid.NewV4(),
	Email:    "testdeveloper@testalm.io",
	FullName: "Test Developer",
}

TestUser only creates in memory obj for testing purposes

View Source
var TestUser2 = account.User{
	ID:       uuid.NewV4(),
	Email:    "testdeveloper2@testalm.io",
	FullName: "Test Developer 2",
}

TestUser2 only creates in memory obj for testing purposes. This TestUser2 can be used to verify that some entity created by TestUser can be later updated or deleted (or not) by another user.

Functions

func CreateRandomValidTestName

func CreateRandomValidTestName(name string) string

CreateRandomValidTestName functions creates a valid lenght name

func CreateTestIdentity

func CreateTestIdentity(db *gorm.DB, username, providerType string) (account.Identity, error)

CreateTestIdentity creates an identity with the given `username` in the database. For testing purpose only.

func CreateTestIdentityForAccountIdentity

func CreateTestIdentityForAccountIdentity(db *gorm.DB, identity *account.Identity) error

CreateTestIdentityForAccountIdentity creates an account.Identity in the database. For testing purpose only. This function unlike CreateTestIdentity() allows to create an Identity with pre-defined ID.

func LoadTestData

func LoadTestData(filename string, provider TestDataProvider) ([]byte, error)

LoadTestData attempt to load test data from local disk unless; * It does not exist or, * Variable REFRESH_DATA is present in ENV

Data is stored under examples/test This is done to avoid always depending on remote systems, but also with an option to refresh/retest against the 'current' remote system data without manual copy/paste

func Run

func Run(b *testing.B, suite BenchingSuite)

Run takes a testing suite and runs all of the benchmarks attached to it.

func ServiceAsSpaceUser

func ServiceAsSpaceUser(serviceName string, tm token.Manager, u account.Identity, authzSrv authz.AuthzService) *goa.Service

ServiceAsSpaceUser creates a new service and fill the context with input Identity and space authz service

func ServiceAsUser

func ServiceAsUser(serviceName string, tm token.Manager, u account.Identity) *goa.Service

ServiceAsUser creates a new service and fill the context with input Identity

func ServiceAsUserWithAuthz

func ServiceAsUserWithAuthz(serviceName string, tm token.Manager, key interface{}, u account.Identity, authorizationPayload auth.AuthorizationPayload) *goa.Service

ServiceAsUserWithAuthz creates a new service and fill the context with input Identity and resource authorization information

func WithAuthz

func WithAuthz(ctx context.Context, key interface{}, ident account.Identity, authz auth.AuthorizationPayload) context.Context

WithAuthz fills the context with token Token is filled using input Identity object and resource authorization information

func WithIdentity

func WithIdentity(ctx context.Context, ident account.Identity) context.Context

WithIdentity fills the context with token Token is filled using input Identity object

Types

type AfterBenchmark

type AfterBenchmark interface {
	AfterBenchmark(suiteName, testName string)
}

AfterBenchmark has a function to be executed right after the benchmark finishes and receives the suite and benchmark names as input

type BeforeBenchmark

type BeforeBenchmark interface {
	BeforeBenchmark(suiteName, testName string)
}

BeforeBenchmark has a function to be executed right before the benchmark starts and receives the suite and benchmark names as input

type BenchingSuite

type BenchingSuite interface {
	B() *testing.B
	SetB(*testing.B)
}

BenchingSuite can store and return the current *testing.B context generated by 'go test -bench=.'.

type SetupAllSuite

type SetupAllSuite interface {
	SetupSuite()
}

SetupAllSuite has a SetupSuite method, which will run before the benchmarks in the suite are run.

type SetupBenchmarkSuite

type SetupBenchmarkSuite interface {
	SetupBenchmark()
}

SetupBenchmarkSuite has a SetupBenchmark method, which will run before each benchmark in the suite.

type Suite

type Suite struct {
	// contains filtered or unexported fields
}

Suite is a basic testing suite with methods for storing and retrieving the current *testing.B context.

func (*Suite) B

func (suite *Suite) B() *testing.B

B retrieves the current *testing.B context.

func (*Suite) SetB

func (suite *Suite) SetB(b *testing.B)

SetB sets the current *testing.B context.

type TearDownAllSuite

type TearDownAllSuite interface {
	TearDownSuite()
}

TearDownAllSuite has a TearDownSuite method, which will run after all the benchmarks in the suite have been run.

type TearDownBenchmarkSuite

type TearDownBenchmarkSuite interface {
	TearDownBenchmark()
}

TearDownBenchmarkSuite has a TearDownBenchmark method, which will run after each benchmark in the suite.

type TestDataProvider

type TestDataProvider func() ([]byte, error)

TestDataProvider defines the simple funcion for returning data from a remote provider

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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