mock

package
v2.2.0-preview.5.4+inc... Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2019 License: CC0-1.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CloudFoundry

type CloudFoundry struct{}

CloudFoundry mock implementation.

func (CloudFoundry) Configure

func (env CloudFoundry) Configure()

Configure the settings per the CloudFoundry environment.

type DatabaseService

type DatabaseService struct {
	SelectFn    func(query interface{}) error
	SelectCount int
}

DatabaseService mock implementation.

func (*DatabaseService) Array

func (service *DatabaseService) Array(model interface{}, expr string, retval interface{}, condition string, params ...interface{})

Array fills an array from the model and expression.

func (*DatabaseService) Close

func (service *DatabaseService) Close() error

Close closes the db connection

func (*DatabaseService) ColumnsWhere

func (service *DatabaseService) ColumnsWhere(model interface{}, columns []string, condition string, params ...interface{}) error

ColumnsWhere is a Conditional selection based on the model in the data store only returning specific quoted columns.

func (*DatabaseService) Count

func (service *DatabaseService) Count(model interface{}, condition string, params ...interface{}) int

Count return the number of rows found.

func (*DatabaseService) CountExpr

func (service *DatabaseService) CountExpr(model interface{}, expr string, retval interface{}, condition string, params ...interface{})

CountExpr return the number of rows found with an expression.

func (*DatabaseService) Delete

func (service *DatabaseService) Delete(query interface{}) error

Delete removes the model from the data store

func (*DatabaseService) Find

func (service *DatabaseService) Find(query interface{}, callback func(query interface{}))

Find will check if the model exists and run the additional functionality.

func (*DatabaseService) FindAll

func (service *DatabaseService) FindAll(model interface{}) error

FindAll instances of a type of model.

func (*DatabaseService) Insert

func (service *DatabaseService) Insert(query ...interface{}) error

Insert persists the new model in the data store

func (*DatabaseService) Raw

func (service *DatabaseService) Raw(query interface{}, params ...interface{}) error

Raw executes a string of SQL.

func (*DatabaseService) Save

func (service *DatabaseService) Save(query ...interface{}) error

Save persists the model in the data store

func (*DatabaseService) Select

func (service *DatabaseService) Select(query interface{}) error

Select returns the model from the data store

func (*DatabaseService) Update

func (service *DatabaseService) Update(query interface{}) error

Update persists the existing model in the data store

func (*DatabaseService) Where

func (service *DatabaseService) Where(model interface{}, condition string, params ...interface{}) error

Where is a conditional selection based on the model in the data store.

type Geocoder

type Geocoder struct{}

Geocoder is a mock implementation.

func (Geocoder) Validate

func (service Geocoder) Validate(api.GeocodeValues) (api.GeocodeResults, error)

Validate takes values to be geocoded and executes a web service call

type LogLine

type LogLine struct {
	Level   string
	Message string
	Fields  api.LogFields
}

LogLine is a mock log line

type LogRecorder

type LogRecorder struct {
	LogService
	// contains filtered or unexported fields
}

LogRecorder is a mock log recorder

func (*LogRecorder) AddField

func (r *LogRecorder) AddField(name string, value interface{})

AddField adds new fields to LogRecorder's globals field

func (*LogRecorder) GetOnlyMatchingMessage

func (r *LogRecorder) GetOnlyMatchingMessage(message string) (LogLine, error)

GetOnlyMatchingMessage returns singular LogLine that matches message or errors

func (*LogRecorder) Info

func (r *LogRecorder) Info(message string, fields api.LogFields)

Info records new LogLine as INFO level

func (*LogRecorder) MatchingMessages

func (r *LogRecorder) MatchingMessages(message string) []LogLine

MatchingMessages compares message to LogLines to seek those LogLines that match on LogRecorder

func (*LogRecorder) RecordLine

func (r *LogRecorder) RecordLine(level string, message string, fields api.LogFields) LogLine

RecordLine records and returns a new LogLine with its level, message, and fields.

type LogService

type LogService struct {
	Off bool
	// contains filtered or unexported fields
}

LogService mock implementation of logging.

func (*LogService) AddField

func (service *LogService) AddField(name string, value interface{})

AddField will add a field using the name and value to the logger.

func (*LogService) Debug

func (service *LogService) Debug(message string, fields api.LogFields)

Debug outputs a debug message to the log.

func (*LogService) DebugError

func (service *LogService) DebugError(message string, err error, fields api.LogFields)

DebugError outputs a debug message and error to the log.

func (*LogService) Fatal

func (service *LogService) Fatal(message string, fields api.LogFields)

Fatal outputs a fatal message to the log.

func (*LogService) FatalError

func (service *LogService) FatalError(message string, err error, fields api.LogFields)

FatalError outputs a fatal message and error to the log.

func (*LogService) Info

func (service *LogService) Info(message string, fields api.LogFields)

Info outputs a informative message to the log.

func (*LogService) InfoError

func (service *LogService) InfoError(message string, err error, fields api.LogFields)

InfoError outputs a informative message and error to the log.

func (*LogService) Panic

func (service *LogService) Panic(message string, fields api.LogFields)

Panic outputs a panic message to the log.

func (*LogService) PanicError

func (service *LogService) PanicError(message string, err error, fields api.LogFields)

PanicError outputs a panic message and error to the log.

func (*LogService) Print

func (service *LogService) Print(message string, fields api.LogFields)

Print outputs a message to the log.

func (*LogService) PrintError

func (service *LogService) PrintError(message string, err error, fields api.LogFields)

PrintError outputs a message and error to the log.

func (*LogService) Warn

func (service *LogService) Warn(message string, fields api.LogFields)

Warn outputs a warning message to the log.

func (*LogService) WarnError

func (service *LogService) WarnError(message string, err error, fields api.LogFields)

WarnError outputs a warning message and error to the log.

type Native

type Native struct{}

Native is a mock (not really) implementation.

func (Native) Configure

func (env Native) Configure()

Configure the environment.

func (Native) Has

func (env Native) Has(name string) bool

Has returns if the environment has a value for the given environment variable.

func (Native) Int

func (env Native) Int(name string) int

Int returns the integer value of the given environment variable.

func (Native) String

func (env Native) String(name string) string

String returns the string value of the given environment variable.

func (Native) True

func (env Native) True(name string) bool

True returns the boolean value of the given environment variable.

type SamlService

type SamlService struct{}

SamlService mock implementation of SAML handling.

func (*SamlService) CreateAuthenticationRequest

func (service *SamlService) CreateAuthenticationRequest() (string, string, error)

CreateAuthenticationRequest creates a SAML 2.0 authentication request based on the service provider settings. If configured to sign the request then the Base64 XML will be signed.

func (*SamlService) ValidateAuthenticationResponse

func (service *SamlService) ValidateAuthenticationResponse(encoded string) (string, error)

ValidateAuthenticationResponse validations a SAML authentication response.

type StorageService

type StorageService struct{}

StorageService is a mock storage service

func (*StorageService) Close

func (s *StorageService) Close() error

Close closes the db connection

func (*StorageService) CreateApplication

func (s *StorageService) CreateApplication(app api.Application) error

CreateApplication creates an application in the db. Errors if already exists.

func (*StorageService) CreateAttachment

func (s *StorageService) CreateAttachment(attachment *api.Attachment) error

CreateAttachment creates an attachment in the database

func (*StorageService) CreateSession

func (s *StorageService) CreateSession(accountID int, sessionKey string, sessionIndex sql.NullString, expirationduration time.Duration) error

CreateSession creates a new session record in the db

func (*StorageService) DeleteApplication

func (s *StorageService) DeleteApplication(accountID int) error

DeleteApplication deletes an attachment for the given account

func (*StorageService) DeleteAttachment

func (s *StorageService) DeleteAttachment(accountID int, attachmentID int) error

DeleteAttachment deletes an attachment for the given account

func (*StorageService) DeleteSession

func (s *StorageService) DeleteSession(sessionKey string) error

DeleteSession removes a session record from the db

func (*StorageService) ExtendAndFetchSessionAccount

func (s *StorageService) ExtendAndFetchSessionAccount(sessionKey string, sessionDuration time.Duration) (api.Account, api.Session, error)

ExtendAndFetchSessionAccount fetches an account and session data from the db

func (*StorageService) FetchPossiblyExpiredSession

func (s *StorageService) FetchPossiblyExpiredSession(accountID int) (api.Session, error)

FetchPossiblyExpiredSession retrieves a session

func (*StorageService) ListAttachmentsMetadata

func (s *StorageService) ListAttachmentsMetadata(accountID int) ([]api.Attachment, error)

ListAttachmentsMetadata returns a slice of attachments' metadata for a given account.

func (*StorageService) LoadApplication

func (s *StorageService) LoadApplication(accountID int) (api.Application, error)

LoadApplication returns the given application from the db.

func (*StorageService) LoadAttachment

func (s *StorageService) LoadAttachment(accountID int, attachmentID int) (api.Attachment, error)

LoadAttachment loads an attachment from the database

func (*StorageService) SaveSection

func (s *StorageService) SaveSection(section api.Section, accountID int) error

SaveSection replaces a single section in the given application with the passed in section

func (*StorageService) UpdateApplication

func (s *StorageService) UpdateApplication(app api.Application) error

UpdateApplication replaces an existing application with the passed in one.

type XMLService

type XMLService struct{}

XMLService is a mock implementation of handling XML.

func (*XMLService) PackageXML

func (service *XMLService) PackageXML(app api.Application) (template.HTML, error)

PackageXML returns a template given data.

Jump to

Keyboard shortcuts

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