fakes

package
v0.0.0-...-2dc3ea6 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2014 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UAAPrivateKey = "PRIVATE-KEY"
	UAAPublicKey  = "PUBLIC-KEY"
)

Variables

View Source
var GUIDGenerator = postal.GUIDGenerationFunc(func() (*uuid.UUID, error) {
	guid := uuid.UUID([16]byte{0xDE, 0xAD, 0xBE, 0xEF, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF, 0x00, 0x11, 0x22, 0x33, 0x44, 0x55})
	return &guid, nil
})

Functions

func BuildToken

func BuildToken(header map[string]interface{}, claims map[string]interface{}) string

func RegisterFastTokenSigningMethod

func RegisterFastTokenSigningMethod()

Types

type ClientsRepo

type ClientsRepo struct {
	Clients     map[string]models.Client
	UpsertError error
	FindError   error
}

func NewClientsRepo

func NewClientsRepo() *ClientsRepo

func (*ClientsRepo) Create

func (fake *ClientsRepo) Create(conn models.ConnectionInterface, client models.Client) (models.Client, error)

func (*ClientsRepo) Find

func (*ClientsRepo) Update

func (fake *ClientsRepo) Update(conn models.ConnectionInterface, client models.Client) (models.Client, error)

func (*ClientsRepo) Upsert

func (fake *ClientsRepo) Upsert(conn models.ConnectionInterface, client models.Client) (models.Client, error)

type Cloak

type Cloak struct {
	EncryptedResult []byte
	DataToEncrypt   []byte
}

func (*Cloak) Unveil

func (cloaker *Cloak) Unveil(data []byte) ([]byte, error)

func (*Cloak) Veil

func (cloaker *Cloak) Veil(data []byte) ([]byte, error)

type CloudController

type CloudController struct {
	CurrentToken                    string
	GetUsersBySpaceGuidError        error
	GetUsersByOrganizationGuidError error
	LoadSpaceError                  error
	LoadOrganizationError           error
	UsersBySpaceGuid                map[string][]cf.CloudControllerUser
	UsersByOrganizationGuid         map[string][]cf.CloudControllerUser
	Spaces                          map[string]cf.CloudControllerSpace
	Orgs                            map[string]cf.CloudControllerOrganization
}

func NewCloudController

func NewCloudController() *CloudController

func (*CloudController) GetUsersByOrgGuid

func (fake *CloudController) GetUsersByOrgGuid(guid, token string) ([]cf.CloudControllerUser, error)

func (*CloudController) GetUsersBySpaceGuid

func (fake *CloudController) GetUsersBySpaceGuid(guid, token string) ([]cf.CloudControllerUser, error)

func (*CloudController) LoadOrganization

func (fake *CloudController) LoadOrganization(guid, token string) (cf.CloudControllerOrganization, error)

func (*CloudController) LoadSpace

func (fake *CloudController) LoadSpace(guid, token string) (cf.CloudControllerSpace, error)

type Courier

type Courier struct {
	Error             error
	Responses         []postal.Response
	DispatchArguments []interface{}
	TheMailer         *Mailer
}

func NewCourier

func NewCourier() *Courier

func (*Courier) Dispatch

func (fake *Courier) Dispatch(token string, guid postal.TypedGUID, options postal.Options, conn models.ConnectionInterface) ([]postal.Response, error)

func (*Courier) Mailer

func (fake *Courier) Mailer() postal.MailerInterface

type DBConn

type DBConn struct {
	BeginWasCalled    bool
	CommitWasCalled   bool
	RollbackWasCalled bool
}

func NewDBConn

func NewDBConn() *DBConn

func (*DBConn) Begin

func (conn *DBConn) Begin() error

func (*DBConn) Commit

func (conn *DBConn) Commit() error

func (DBConn) Delete

func (conn DBConn) Delete(list ...interface{}) (int64, error)

func (*DBConn) Exec

func (conn *DBConn) Exec(query string, args ...interface{}) (sql.Result, error)

func (DBConn) Insert

func (conn DBConn) Insert(list ...interface{}) error

func (*DBConn) Rollback

func (conn *DBConn) Rollback() error

func (DBConn) Select

func (conn DBConn) Select(i interface{}, query string, args ...interface{}) ([]interface{}, error)

func (DBConn) SelectOne

func (conn DBConn) SelectOne(i interface{}, query string, args ...interface{}) error

func (*DBConn) Transaction

func (conn *DBConn) Transaction() models.TransactionInterface

func (DBConn) Update

func (conn DBConn) Update(list ...interface{}) (int64, error)

type DBResult

type DBResult struct{}

func (DBResult) LastInsertId

func (fake DBResult) LastInsertId() (int64, error)

func (DBResult) RowsAffected

func (fake DBResult) RowsAffected() (int64, error)

type Database

type Database struct {
	Conn *DBConn
}

func NewDatabase

func NewDatabase() *Database

func (Database) Connection

func (fake Database) Connection() models.ConnectionInterface

func (Database) TraceOn

func (fake Database) TraceOn(prefix string, logger gorp.GorpLogger)

type ErrorWriter

type ErrorWriter struct {
	Error error
}

func NewErrorWriter

func NewErrorWriter() *ErrorWriter

func (*ErrorWriter) Write

func (writer *ErrorWriter) Write(w http.ResponseWriter, err error)

type FakeNotify

type FakeNotify struct {
	Response []byte
	GUID     postal.TypedGUID
	Error    error
}

func (*FakeNotify) Execute

func (fake *FakeNotify) Execute(connection models.ConnectionInterface, req *http.Request, context stack.Context,
	guid postal.TypedGUID, recipe postal.RecipeInterface) ([]byte, error)

type FakePreferenceUpdater

type FakePreferenceUpdater struct {
	ExecuteArguments []interface{}
	ExecuteError     error
}

func NewFakePreferenceUpdater

func NewFakePreferenceUpdater() *FakePreferenceUpdater

func (*FakePreferenceUpdater) Execute

func (fake *FakePreferenceUpdater) Execute(conn models.ConnectionInterface, preferences []models.Preference, globalUnsubscribe bool, userID string) error

type FakePreferencesFinder

type FakePreferencesFinder struct {
	ReturnValue services.PreferencesBuilder
	FindError   error
	UserGUID    string
}

func NewFakePreferencesFinder

func NewFakePreferencesFinder(returnValue services.PreferencesBuilder) *FakePreferencesFinder

func (*FakePreferencesFinder) Find

type FakePreferencesRepo

type FakePreferencesRepo struct {
	NonCriticalPreferences []models.Preference
	FindError              error
}

func NewFakePreferencesRepo

func NewFakePreferencesRepo(nonCriticalPreferences []models.Preference) *FakePreferencesRepo

func (FakePreferencesRepo) FindNonCriticalPreferences

func (fake FakePreferencesRepo) FindNonCriticalPreferences(conn models.ConnectionInterface, userGUID string) ([]models.Preference, error)

type FakeQueue

type FakeQueue struct {
	EnqueueError error
	// contains filtered or unexported fields
}

func NewFakeQueue

func NewFakeQueue() *FakeQueue

func (*FakeQueue) Dequeue

func (fake *FakeQueue) Dequeue(job gobble.Job)

func (*FakeQueue) Enqueue

func (fake *FakeQueue) Enqueue(job gobble.Job) (gobble.Job, error)

func (*FakeQueue) Requeue

func (fake *FakeQueue) Requeue(job gobble.Job)

func (*FakeQueue) Reserve

func (fake *FakeQueue) Reserve(string) <-chan gobble.Job

type FakeRegistrar

type FakeRegistrar struct {
	RegisterArguments []interface{}
	RegisterError     error
	PruneArguments    []interface{}
	PruneError        error
}

func NewFakeRegistrar

func NewFakeRegistrar() *FakeRegistrar

func (*FakeRegistrar) Prune

func (fake *FakeRegistrar) Prune(conn models.ConnectionInterface, client models.Client, kinds []models.Kind) error

func (*FakeRegistrar) Register

func (fake *FakeRegistrar) Register(conn models.ConnectionInterface, client models.Client, kinds []models.Kind) error

type FakeTemplateDeleter

type FakeTemplateDeleter struct {
	DeleteArgument string
	DeleteError    error
}

func NewFakeTemplateDeleter

func NewFakeTemplateDeleter() *FakeTemplateDeleter

func (*FakeTemplateDeleter) Delete

func (fake *FakeTemplateDeleter) Delete(templateName string) error

type FakeTemplateFinder

type FakeTemplateFinder struct {
	TemplateName string
	FindError    error
	Templates    map[string]models.Template
}

func NewFakeTemplateFinder

func NewFakeTemplateFinder() *FakeTemplateFinder

func (*FakeTemplateFinder) Find

func (fake *FakeTemplateFinder) Find(templateName string) (models.Template, error)

type FakeTemplateUpdater

type FakeTemplateUpdater struct {
	UpdateArgument models.Template
	UpdateError    error
}

func NewFakeTemplateUpdater

func NewFakeTemplateUpdater() *FakeTemplateUpdater

func (*FakeTemplateUpdater) Update

func (fake *FakeTemplateUpdater) Update(template models.Template) error

type FakeTemplatesRepo

type FakeTemplatesRepo struct {
	Templates       map[string]models.Template
	FindError       error
	UpsertError     error
	DestroyArgument string
	DestroyError    error
}

func NewFakeTemplatesRepo

func NewFakeTemplatesRepo() *FakeTemplatesRepo

func (*FakeTemplatesRepo) Destroy

func (fake *FakeTemplatesRepo) Destroy(conn models.ConnectionInterface, templateName string) error

func (FakeTemplatesRepo) Find

func (fake FakeTemplatesRepo) Find(conn models.ConnectionInterface, templateName string) (models.Template, error)

func (FakeTemplatesRepo) Upsert

type FakeUAAClient

type FakeUAAClient struct {
	ClientToken      uaa.Token
	ClientTokenError error
	UsersByID        map[string]uaa.User
	ErrorForUserByID error
	AccessToken      string
}

func (FakeUAAClient) GetClientToken

func (fake FakeUAAClient) GetClientToken() (uaa.Token, error)

func (*FakeUAAClient) SetToken

func (fake *FakeUAAClient) SetToken(token string)

func (FakeUAAClient) UsersEmailsByIDs

func (fake FakeUAAClient) UsersEmailsByIDs(ids ...string) ([]uaa.User, error)

type FileSystem

type FileSystem struct {
	Files map[string]string
}

func NewFileSystem

func NewFileSystem(rootPath string) FileSystem

func (FileSystem) Exists

func (fs FileSystem) Exists(path string) bool

func (FileSystem) Read

func (fs FileSystem) Read(path string) (string, error)

type Finder

type Finder struct {
	Clients            map[string]models.Client
	Kinds              map[string]models.Kind
	ClientAndKindError error
}

func NewFinder

func NewFinder() *Finder

func (*Finder) ClientAndKind

func (finder *Finder) ClientAndKind(clientID, kindID string) (models.Client, models.Kind, error)

type GlobalUnsubscribesRepo

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

func NewGlobalUnsubscribesRepo

func NewGlobalUnsubscribesRepo() *GlobalUnsubscribesRepo

func (*GlobalUnsubscribesRepo) Get

func (*GlobalUnsubscribesRepo) Set

func (fake *GlobalUnsubscribesRepo) Set(conn models.ConnectionInterface, userID string, globalUnsubscribe bool) error

type KindsRepo

type KindsRepo struct {
	Kinds         map[string]models.Kind
	UpsertError   error
	TrimError     error
	FindError     error
	TrimArguments []interface{}
}

func NewKindsRepo

func NewKindsRepo() *KindsRepo

func (*KindsRepo) Create

func (fake *KindsRepo) Create(conn models.ConnectionInterface, kind models.Kind) (models.Kind, error)

func (*KindsRepo) Find

func (fake *KindsRepo) Find(conn models.ConnectionInterface, id, clientID string) (models.Kind, error)

func (*KindsRepo) Trim

func (fake *KindsRepo) Trim(conn models.ConnectionInterface, clientID string, kindIDs []string) (int, error)

func (*KindsRepo) Update

func (fake *KindsRepo) Update(conn models.ConnectionInterface, kind models.Kind) (models.Kind, error)

func (*KindsRepo) Upsert

func (fake *KindsRepo) Upsert(conn models.ConnectionInterface, kind models.Kind) (models.Kind, error)

type MailClient

type MailClient struct {
	Messages     []mail.Message
	SendError    error
	ConnectError error
}

func NewMailClient

func NewMailClient() MailClient

func (*MailClient) Connect

func (fake *MailClient) Connect() error

func (*MailClient) Send

func (fake *MailClient) Send(msg mail.Message) error

type MailRecipe

type MailRecipe struct {
	DispatchArguments []interface{}
	Responses         []postal.Response
	Error             error
	TrimCalled        bool
}

func NewMailRecipe

func NewMailRecipe() *MailRecipe

func (*MailRecipe) Dispatch

func (fake *MailRecipe) Dispatch(clientID string, guid postal.TypedGUID,
	options postal.Options, conn models.ConnectionInterface) ([]postal.Response, error)

func (*MailRecipe) Trim

func (fake *MailRecipe) Trim(response []byte) []byte

type Mailer

type Mailer struct {
	DeliverArguments map[string]interface{}
	Responses        []postal.Response
}

func NewMailer

func NewMailer() *Mailer

func (*Mailer) Deliver

func (fake *Mailer) Deliver(conn models.ConnectionInterface, template postal.Templates, users map[string]uaa.User, options postal.Options, space cf.CloudControllerSpace, org cf.CloudControllerOrganization, client string) []postal.Response

type ReceiptsRepo

type ReceiptsRepo struct {
	CreateUserGUIDs     []string
	ClientID            string
	KindID              string
	CreateReceiptsError bool
}

func NewReceiptsRepo

func NewReceiptsRepo() *ReceiptsRepo

func (*ReceiptsRepo) CreateReceipts

func (fake *ReceiptsRepo) CreateReceipts(conn models.ConnectionInterface, userGUIDs []string, clientID, kindID string) error

type SigningMethodFast

type SigningMethodFast struct{}

func (SigningMethodFast) Alg

func (m SigningMethodFast) Alg() string

func (SigningMethodFast) Sign

func (m SigningMethodFast) Sign(signingString string, key []byte) (string, error)

func (SigningMethodFast) Verify

func (m SigningMethodFast) Verify(signingString, signature string, key []byte) (err error)

type SpaceAndOrgLoader

type SpaceAndOrgLoader struct {
	LoadError    error
	Space        cf.CloudControllerSpace
	Organization cf.CloudControllerOrganization
}

func NewSpaceAndOrgLoader

func NewSpaceAndOrgLoader() *SpaceAndOrgLoader

type TemplatesLoader

type TemplatesLoader struct {
	ContentSuffix string
	Templates     postal.Templates
	LoadError     error
}

func (*TemplatesLoader) LoadTemplates

func (fake *TemplatesLoader) LoadTemplates(subjectSuffix, contentSuffix, clientID, kindID string) (postal.Templates, error)

type TokenLoader

type TokenLoader struct {
	Token     string
	LoadError error
}

func NewTokenLoader

func NewTokenLoader() *TokenLoader

func (*TokenLoader) Load

func (fake *TokenLoader) Load() (string, error)

type UnsubscribesRepo

type UnsubscribesRepo struct {
	Unsubscribes map[string]models.Unsubscribe
}

func NewUnsubscribesRepo

func NewUnsubscribesRepo() *UnsubscribesRepo

func (*UnsubscribesRepo) Create

func (*UnsubscribesRepo) Destroy

func (fake *UnsubscribesRepo) Destroy(conn models.ConnectionInterface, unsubscribe models.Unsubscribe) (int, error)

func (*UnsubscribesRepo) Find

func (fake *UnsubscribesRepo) Find(conn models.ConnectionInterface, clientID string, kindID string, userID string) (models.Unsubscribe, error)

func (*UnsubscribesRepo) Upsert

type UserLoader

type UserLoader struct {
	Users     map[string]uaa.User
	LoadError error
}

func NewUserLoader

func NewUserLoader() *UserLoader

func (*UserLoader) Load

func (fake *UserLoader) Load(postal.TypedGUID, string) (map[string]uaa.User, error)

Jump to

Keyboard shortcuts

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