mock

package
v0.0.0-...-ad0da93 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2018 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EchoCtx

func EchoCtx(r *http.Request, w http.ResponseWriter) echo.Context

EchoCtx returns new Echo context, with validator and content type set

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 Str2Ptr

func Str2Ptr(s string) *string

Str2Ptr converts string to pointer

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 Auth

type Auth struct {
	UserFn func(echo.Context) *model.AuthUser
}

Auth mock

func (*Auth) User

func (a *Auth) User(c echo.Context) *model.AuthUser

User mock

type JWT

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

JWT mock

func (*JWT) GenerateToken

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

GenerateToken mock

type RBAC

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

RBAC Mock

func (*RBAC) AccountCreate

func (a *RBAC) AccountCreate(c echo.Context, roleID, companyID, 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 model.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 model.AccessRole) error

IsLowerRole mock

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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