mock

package
v0.0.0-...-82cb9bc Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EchoCtxWithKeys

func EchoCtxWithKeys(keys []string, values ...interface{}) echo.Context

EchoCtxWithKeys returns new Echo context with keys

func HeaderInvalid

func HeaderInvalid() string

HeaderInvalid is used for jwt testing

func HeaderValid

func HeaderValid() string

HeaderValid is used for jwt testing

func InsertMultiple

func InsertMultiple(db *pg.DB, models ...interface{}) error

InsertMultiple inserts multiple values into database

func NewDB

func NewDB(t *testing.T, con *dockertest.Container, models ...interface{}) *pg.DB

NewDB instantiates new postgresql database connection via docker container

func NewPGContainer

func NewPGContainer(t *testing.T) *dockertest.Container

NewPGContainer instantiates new PostgreSQL docker container

func TestTime

func TestTime(year int) time.Time

TestTime is used for testing time fields

func TestTimePtr

func TestTimePtr(year int) *time.Time

TestTimePtr is used for testing pointer time fields

Types

type JWT

type JWT struct {
	GenerateTokenFn func(*rest.User) (string, string, error)
}

JWT mock

func (*JWT) GenerateToken

func (j *JWT) GenerateToken(u *rest.User) (string, string, error)

GenerateToken mock

type RBAC

type RBAC struct {
	UserFn            func(echo.Context) *rest.AuthUser
	EnforceRoleFn     func(echo.Context, rest.AccessRole) error
	EnforceUserFn     func(echo.Context, int) error
	EnforceCompanyFn  func(echo.Context, int) error
	EnforceLocationFn func(echo.Context, int) error
	AccountCreateFn   func(echo.Context, rest.AccessRole, int) error
	IsLowerRoleFn     func(echo.Context, rest.AccessRole) error
}

RBAC Mock

func (*RBAC) AccountCreate

func (a *RBAC) AccountCreate(c echo.Context, roleID rest.AccessRole, locationID int) error

AccountCreate mock

func (*RBAC) EnforceCompany

func (a *RBAC) EnforceCompany(c echo.Context, id int) error

EnforceCompany mock

func (*RBAC) EnforceLocation

func (a *RBAC) EnforceLocation(c echo.Context, id int) error

EnforceLocation mock

func (*RBAC) EnforceRole

func (a *RBAC) EnforceRole(c echo.Context, role rest.AccessRole) error

EnforceRole mock

func (*RBAC) EnforceUser

func (a *RBAC) EnforceUser(c echo.Context, id int) error

EnforceUser mock

func (*RBAC) IsLowerRole

func (a *RBAC) IsLowerRole(c echo.Context, role rest.AccessRole) error

IsLowerRole mock

func (*RBAC) User

func (a *RBAC) User(c echo.Context) *rest.AuthUser

User mock

type Secure

type Secure struct {
	PasswordFn            func(string, ...string) bool
	HashFn                func(string) string
	HashMatchesPasswordFn func(string, string) bool
	TokenFn               func(string) string
}

Secure mock

func (*Secure) Hash

func (s *Secure) Hash(pw string) string

Hash mock

func (*Secure) HashMatchesPassword

func (s *Secure) HashMatchesPassword(hash, pw string) bool

HashMatchesPassword mock

func (*Secure) Password

func (s *Secure) Password(pw string, inputs ...string) bool

Password mock

func (*Secure) Token

func (s *Secure) Token(token string) string

Token mock

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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