mock

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

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

Go to latest
Published: Aug 9, 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) 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 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) 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) CreateOrUpdateSession

func (s *StorageService) CreateOrUpdateSession(accountID int, sessionKey string, expirationDate time.Time) error

CreateOrUpdateSession 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) FetchSessionAccount

func (s *StorageService) FetchSessionAccount(sessionKey string) (api.Account, error)

FetchSessionAccount fetches an account and session data from the db

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 TokenService

type TokenService struct{}

TokenService is a mock implementation of JWT service handling.

func (TokenService) CheckToken

func (service TokenService) CheckToken(request *http.Request) (string, int, error)

CheckToken tests if the token is valid and is of the correct audience.

func (TokenService) ConfigureEnvironment

func (service TokenService) ConfigureEnvironment(size int) error

ConfigureEnvironment ensure the secret is set prior to use.

func (TokenService) CurrentAudience

func (service TokenService) CurrentAudience(request *http.Request) string

CurrentAudience is the currently valid audience from the token.

func (TokenService) ExtractToken

func (service TokenService) ExtractToken(request *http.Request) string

ExtractToken returns the token from an HTTP request header.

func (TokenService) NewToken

func (service TokenService) NewToken(id int, audience string) (string, time.Time, error)

NewToken generates a new Jwt signed token using a users account information

func (TokenService) Secret

func (service TokenService) Secret() []byte

Secret returns the secret to use with JWT tokens.

func (TokenService) TargetAudiences

func (service TokenService) TargetAudiences() []string

TargetAudiences which are accepted based on the configured environment.

func (TokenService) Timeout

func (service TokenService) Timeout() time.Duration

Timeout returns the duration in time for how long a session is considered valid. Per policy this defaults to 15 minutes.

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