test_helpers

package
v0.0.0-...-a8e4d9d Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2020 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TestPlan = &domain.BillingPlan{
		Uuid:             "c9569087-ff00-446b-b002-d29e7c3d38c0",
		PricePerMonth:    domain.Money{Amount: 10, Currency: domain.EUR},
		UsersIncluded:    1,
		ProjectsIncluded: 2,
	}
)

Functions

func Flaky

func Flaky(t *testing.T)

func GetConfig

func GetConfig(t *testing.T) *config.Config

func GetDbConnection

func GetDbConnection(t *testing.T) *sqlx.DB

func GetDbTx

func GetDbTx(t *testing.T) *sqlx.Tx

func InStrings

func InStrings(needle string, haystack []string) bool

func IsBraintreeProxyAvailable

func IsBraintreeProxyAvailable() bool

func MustCreateEnvironment

func MustCreateEnvironment(t *testing.T, tx *sqlx.Tx, env *domain.Environment) *domain.Environment

func MustCreateGitTrigger

func MustCreateGitTrigger(t *testing.T, tx *sqlx.Tx, trigger *domain.GitTrigger) *domain.GitTrigger

func MustCreateInvitation

func MustCreateInvitation(t *testing.T, tx *sqlx.Tx, inv *domain.Invitation) *domain.Invitation

func MustCreateJob

func MustCreateJob(t *testing.T, tx *sqlx.Tx, job *domain.Job) *domain.Job

func MustCreateOAuthToken

func MustCreateOAuthToken(t *testing.T, tx *sqlx.Tx, token *domain.OAuthToken) *domain.OAuthToken

func MustCreateOperation

func MustCreateOperation(t *testing.T, tx *sqlx.Tx, o *domain.Operation) *domain.Operation

func MustCreateOrganization

func MustCreateOrganization(t *testing.T, tx *sqlx.Tx, o *domain.Organization) *domain.Organization

func MustCreateProject

func MustCreateProject(t *testing.T, tx *sqlx.Tx, p *domain.Project) *domain.Project

func MustCreateProjectMembership

func MustCreateProjectMembership(t *testing.T, tx *sqlx.Tx, membership *domain.ProjectMembership) *domain.ProjectMembership

func MustCreateRepository

func MustCreateRepository(t *testing.T, tx *sqlx.Tx, r *domain.Repository) *domain.Repository

func MustCreateSchedule

func MustCreateSchedule(t *testing.T, tx *sqlx.Tx, schedule *domain.Schedule) *domain.Schedule

func MustCreateSecret

func MustCreateSecret(t *testing.T, tx *sqlx.Tx, ss stores.SecretKeyValueStore, secret *domain.Secret) *domain.Secret

func MustCreateSession

func MustCreateSession(t *testing.T, tx *sqlx.Tx, s *domain.Session) *domain.Session

func MustCreateTask

func MustCreateTask(t *testing.T, tx *sqlx.Tx, task *domain.Task) *domain.Task

func MustCreateUser

func MustCreateUser(t *testing.T, tx *sqlx.Tx, u *domain.User) *domain.User

func MustCreateWorkspaceBaseImage

func MustCreateWorkspaceBaseImage(t *testing.T, tx *sqlx.Tx, wsbi *domain.WorkspaceBaseImage) *domain.WorkspaceBaseImage

func MustSelectBillingPlan

func MustSelectBillingPlan(t *testing.T, tx *sqlx.Tx, organization *domain.Organization, plan *domain.BillingPlan)

Types

type MockAuthzService

type MockAuthzService struct {
	CapabilitiesBySubjectMap map[string][]string
	// contains filtered or unexported fields
}

func NewMockAuthzService

func NewMockAuthzService() *MockAuthzService

func (*MockAuthzService) Can

func (s *MockAuthzService) Can(action string, thing interface{}) (bool, error)

func (*MockAuthzService) CanArchive

func (s *MockAuthzService) CanArchive(thing interface{}) (bool, error)

func (*MockAuthzService) CanCreate

func (s *MockAuthzService) CanCreate(thing interface{}) (bool, error)

func (*MockAuthzService) CanRead

func (s *MockAuthzService) CanRead(thing interface{}) (bool, error)

func (*MockAuthzService) CanUpdate

func (s *MockAuthzService) CanUpdate(thing interface{}) (bool, error)

func (*MockAuthzService) CapabilitiesBySubject

func (s *MockAuthzService) CapabilitiesBySubject() map[string][]string

func (*MockAuthzService) Expect

func (s *MockAuthzService) Expect(t *testing.T, method string, calls int)

func (*MockAuthzService) Log

func (s *MockAuthzService) Log() logger.Logger

func (*MockAuthzService) SetLogger

func (s *MockAuthzService) SetLogger(l logger.Logger)

type MockKeyValueStore

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

func NewMockKeyValueStore

func NewMockKeyValueStore() *MockKeyValueStore

func (*MockKeyValueStore) Close

func (self *MockKeyValueStore) Close() error

func (*MockKeyValueStore) Del

func (self *MockKeyValueStore) Del(key string) error

func (*MockKeyValueStore) Exists

func (self *MockKeyValueStore) Exists(key string) (bool, error)

func (*MockKeyValueStore) Get

func (self *MockKeyValueStore) Get(key string) ([]byte, error)

func (*MockKeyValueStore) LPush

func (self *MockKeyValueStore) LPush(key string, data string) error

func (*MockKeyValueStore) LRange

func (self *MockKeyValueStore) LRange(key string, start, stop int64) ([]string, error)

func (*MockKeyValueStore) RPush

func (self *MockKeyValueStore) RPush(key string, data string) error

func (*MockKeyValueStore) SAdd

func (self *MockKeyValueStore) SAdd(key, member string) (int64, error)

func (*MockKeyValueStore) SIsMember

func (self *MockKeyValueStore) SIsMember(key, member string) (bool, error)

func (*MockKeyValueStore) SMembers

func (self *MockKeyValueStore) SMembers(key string) ([]string, error)

func (*MockKeyValueStore) SRem

func (self *MockKeyValueStore) SRem(key, member string) (int64, error)

func (*MockKeyValueStore) Set

func (self *MockKeyValueStore) Set(key string, data []byte) error

type MockSecretKeyValueStore

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

func NewMockSecretKeyValueStore

func NewMockSecretKeyValueStore() *MockSecretKeyValueStore

func (*MockSecretKeyValueStore) Del

func (self *MockSecretKeyValueStore) Del(key string) error

func (*MockSecretKeyValueStore) Get

func (self *MockSecretKeyValueStore) Get(key string, passphrase []byte) ([]byte, error)

func (*MockSecretKeyValueStore) Set

func (self *MockSecretKeyValueStore) Set(key string, passphrase, data []byte) error

type World

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

func MustNewWorld

func MustNewWorld(tx *sqlx.Tx, t *testing.T) *World

Use this if you don't care for the stores.KeyValueStore

func MustNewWorldUsingSecretKeyValueStore

func MustNewWorldUsingSecretKeyValueStore(tx *sqlx.Tx, ss stores.SecretKeyValueStore, t *testing.T) *World

func (*World) Environment

func (w *World) Environment(tag string) *domain.Environment

func (*World) Job

func (w *World) Job(tag string) *domain.Job

func (*World) MustLoadDefaults

func (w *World) MustLoadDefaults(tx *sqlx.Tx, ss stores.SecretKeyValueStore, t *testing.T)

func (*World) Organization

func (w *World) Organization(tag string) *domain.Organization

func (*World) OrganizationMembership

func (w *World) OrganizationMembership(tag string) *domain.OrganizationMembership

func (*World) Project

func (w *World) Project(tag string) *domain.Project

func (*World) ProjectMembership

func (w *World) ProjectMembership(tag string) *domain.ProjectMembership

func (*World) Repository

func (w *World) Repository(tag string) *domain.Repository

func (*World) RepositoryCredential

func (w *World) RepositoryCredential(tag string) *domain.RepositoryCredential

func (*World) Schedule

func (w *World) Schedule(tag string) *domain.Schedule

func (*World) Secret

func (w *World) Secret(tag string) *domain.Secret

func (*World) Task

func (w *World) Task(tag string) *domain.Task

func (*World) User

func (w *World) User(tag string) *domain.User

func (*World) WorkspaceBaseImage

func (w *World) WorkspaceBaseImage(tag string) *domain.WorkspaceBaseImage

Jump to

Keyboard shortcuts

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