mock

package
v0.0.0-...-8cb3723 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GinCtxWithKeys

func GinCtxWithKeys(keys []string, values ...interface{}) *gin.Context

GinCtxWithKeys returns new gin 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(*gin.Context) *model.AuthUser
}

Auth mock

func (*Auth) User

func (a *Auth) User(c *gin.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 Magic

type Magic struct {
	IsValidtokenFn func(string) (*token.Token, error)
	GetIssuerFn    func(*token.Token) (*mag.UserInfo, error)
}

func (*Magic) GetIssuer

func (m *Magic) GetIssuer(tok *token.Token) (*mag.UserInfo, error)

func (*Magic) IsValidToken

func (m *Magic) IsValidToken(token string) (*token.Token, error)

type Mail

type Mail struct {
	ExternalURL                   string
	SendFn                        func(string, string, string, string, string) error
	SendWithDefaultsFn            func(string, string, string, string) error
	SendVerificationEmailFn       func(string, *model.Verification) error
	SendForgotVerificationEmailFn func(string, *model.Verification) error
}

Mail mock

func (*Mail) Send

func (m *Mail) Send(subject, toName, toEmail, content, html string) error

Send mock

func (*Mail) SendForgotVerificationEmail

func (m *Mail) SendForgotVerificationEmail(toEmail string, v *model.Verification) error

func (*Mail) SendVerificationEmail

func (m *Mail) SendVerificationEmail(toEmail string, v *model.Verification) error

SendVerificationEmail mock

func (*Mail) SendWithDefaults

func (m *Mail) SendWithDefaults(subject, toEmail, content, html string) error

SendWithDefaults mock

type Mobile

type Mobile struct {
	GenerateSMSTokenFn func(string, string) error
	CheckCodeFn        func(string, string, string) error
}

Mobile mock

func (*Mobile) CheckCode

func (m *Mobile) CheckCode(countryCode, mobile, code string) error

CheckCode mock

func (*Mobile) GenerateSMSToken

func (m *Mobile) GenerateSMSToken(countryCode, mobile string) error

GenerateSMSToken mock

type Password

type Password struct {
	HashPasswordFn        func(string) string
	HashMatchesPasswordFn func(hash, password string) bool
	HashRandomPasswordFn  func() (string, error)
}

Password mock

func (*Password) HashMatchesPassword

func (p *Password) HashMatchesPassword(hash, password string) bool

HashMatchesPassword mock

func (*Password) HashPassword

func (p *Password) HashPassword(password string) string

HashPassword mock

func (*Password) HashRandomPassword

func (p *Password) HashRandomPassword() (string, error)

HashRandomPassword mock

type RBAC

type RBAC struct {
	EnforceRoleFn   func(*gin.Context, model.AccessRole) bool
	EnforceUserFn   func(*gin.Context, int) bool
	AccountCreateFn func(*gin.Context, int) bool
	IsLowerRoleFn   func(*gin.Context, model.AccessRole) bool
}

RBAC Mock

func (*RBAC) AccountCreate

func (a *RBAC) AccountCreate(c *gin.Context, roleID int) bool

AccountCreate mock

func (*RBAC) EnforceRole

func (a *RBAC) EnforceRole(c *gin.Context, role model.AccessRole) bool

EnforceRole mock

func (*RBAC) EnforceUser

func (a *RBAC) EnforceUser(c *gin.Context, id int) bool

EnforceUser mock

func (*RBAC) IsLowerRole

func (a *RBAC) IsLowerRole(c *gin.Context, role model.AccessRole) bool

IsLowerRole mock

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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