testscommon

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2026 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessCheckerStub

type AccessCheckerStub struct {
	ShouldProcessRequestHandler func(header http.Header, requestURI string) (string, error)
}

AccessCheckerStub -

func (*AccessCheckerStub) IsInterfaceNil

func (stub *AccessCheckerStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*AccessCheckerStub) ShouldProcessRequest

func (stub *AccessCheckerStub) ShouldProcessRequest(header http.Header, requestURI string) (string, error)

ShouldProcessRequest -

type AuthenticatorStub

type AuthenticatorStub struct {
	GenerateTokenHandler func(username string, isAdmin bool) (string, error)
	CheckAuthHandler     func(r *http.Request) (*common.Claims, error)
}

AuthenticatorStub -

func (*AuthenticatorStub) CheckAuth

func (stub *AuthenticatorStub) CheckAuth(r *http.Request) (*common.Claims, error)

CheckAuth -

func (*AuthenticatorStub) GenerateToken

func (stub *AuthenticatorStub) GenerateToken(username string, isAdmin bool) (string, error)

GenerateToken -

func (*AuthenticatorStub) IsInterfaceNil

func (stub *AuthenticatorStub) IsInterfaceNil() bool

IsInterfaceNil -

type CaptchaHandlerStub

type CaptchaHandlerStub struct {
	VerifyStringHandler func(id string, digits string) bool
	NewCaptchaHandler   func() string
	ReloadHandler       func(id string)
	WriteNoErrorHandler func(w io.Writer, id string)
}

CaptchaHandlerStub -

func (*CaptchaHandlerStub) IsInterfaceNil

func (stub *CaptchaHandlerStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*CaptchaHandlerStub) NewCaptcha

func (stub *CaptchaHandlerStub) NewCaptcha() string

NewCaptcha -

func (*CaptchaHandlerStub) Reload

func (stub *CaptchaHandlerStub) Reload(id string)

Reload -

func (*CaptchaHandlerStub) VerifyString

func (stub *CaptchaHandlerStub) VerifyString(id string, digits string) bool

VerifyString -

func (*CaptchaHandlerStub) WriteNoError

func (stub *CaptchaHandlerStub) WriteNoError(w io.Writer, id string)

WriteNoError -

type CryptoPaymentClientStub

type CryptoPaymentClientStub struct {
	GetConfigHandler     func() (*common.CryptoPaymentConfig, error)
	CreateAddressHandler func() (*common.CreateAddressResponse, error)
	GetAccountHandler    func(paymentID uint64) (*common.AccountInfo, error)
}

CryptoPaymentClientStub -

func (*CryptoPaymentClientStub) CreateAddress

func (stub *CryptoPaymentClientStub) CreateAddress() (*common.CreateAddressResponse, error)

CreateAddress -

func (*CryptoPaymentClientStub) GetAccount

func (stub *CryptoPaymentClientStub) GetAccount(paymentID uint64) (*common.AccountInfo, error)

GetAccount -

func (*CryptoPaymentClientStub) GetConfig

GetConfig -

func (*CryptoPaymentClientStub) IsInterfaceNil

func (stub *CryptoPaymentClientStub) IsInterfaceNil() bool

IsInterfaceNil -

type EmailSenderStub

type EmailSenderStub struct {
	SendEmailHandler      func(to string, subject string, body any, htmlTemplate string) error
	IsInterfaceNilHandler func() bool
}

EmailSenderStub is a stub for EmailSender

func (*EmailSenderStub) IsInterfaceNil

func (stub *EmailSenderStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*EmailSenderStub) SendEmail

func (stub *EmailSenderStub) SendEmail(to string, subject string, body any, htmlTemplate string) error

SendEmail -

type HostsFinderStub

type HostsFinderStub struct {
	FindHostCalled       func(urlValues map[string][]string) (config.GatewayConfig, error)
	LoadedGatewaysCalled func() []config.GatewayConfig
}

HostsFinderStub -

func (*HostsFinderStub) FindHost

func (stub *HostsFinderStub) FindHost(urlValues map[string][]string) (config.GatewayConfig, error)

FindHost -

func (*HostsFinderStub) IsInterfaceNil

func (stub *HostsFinderStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*HostsFinderStub) LoadedGateways

func (stub *HostsFinderStub) LoadedGateways() []config.GatewayConfig

LoadedGateways -

type HttpHandlerStub

type HttpHandlerStub struct {
	ServeHTTPCalled func(writer http.ResponseWriter, request *http.Request)
}

HttpHandlerStub -

func (*HttpHandlerStub) ServeHTTP

func (stub *HttpHandlerStub) ServeHTTP(writer http.ResponseWriter, request *http.Request)

ServeHTTP -

type HttpRequesterStub

type HttpRequesterStub struct {
	DoRequestHandler func(method string, url string, apiKey string, result any) error
}

HttpRequesterStub -

func (*HttpRequesterStub) DoRequest

func (stub *HttpRequesterStub) DoRequest(method string, url string, apiKey string, result any) error

DoRequest -

func (*HttpRequesterStub) IsInterfaceNil

func (stub *HttpRequesterStub) IsInterfaceNil() bool

IsInterfaceNil -

type KeyCounterStub

type KeyCounterStub struct {
	IncrementReturningCurrentHandler func(key string) uint64
	ClearHandler                     func()
}

KeyCounterStub -

func (*KeyCounterStub) Clear

func (stub *KeyCounterStub) Clear()

Clear -

func (*KeyCounterStub) IncrementReturningCurrent

func (stub *KeyCounterStub) IncrementReturningCurrent(key string) uint64

IncrementReturningCurrent -

func (*KeyCounterStub) IsInterfaceNil

func (stub *KeyCounterStub) IsInterfaceNil() bool

IsInterfaceNil -

type PerformanceMonitorStub

type PerformanceMonitorStub struct {
	AddPerformanceMetricAsyncHandler func(label string)
}

PerformanceMonitorStub -

func (*PerformanceMonitorStub) AddPerformanceMetricAsync

func (stub *PerformanceMonitorStub) AddPerformanceMetricAsync(label string)

AddPerformanceMetric -

func (*PerformanceMonitorStub) IsInterfaceNil

func (stub *PerformanceMonitorStub) IsInterfaceNil() bool

IsInterfaceNil -

type StorerStub

type StorerStub struct {
	RemoveUserHandler                        func(username string) error
	UpdateUserHandler                        func(username string, password string, isAdmin bool, maxRequests uint64, isPremium bool) error
	AddUserHandler                           func(username string, password string, isAdmin bool, maxRequests uint64, isPremium bool, isActive bool, activationToken string) error
	AddKeyHandler                            func(username string, key string) error
	RemoveKeyHandler                         func(username string, key string) error
	GetAllKeysHandler                        func(username string) (map[string]common.AccessKeyDetails, error)
	GetAllUsersHandler                       func() (map[string]common.UsersDetails, error)
	IsKeyAllowedHandler                      func(key string) (string, common.AccountType, error)
	CloseHandler                             func() error
	CheckUserCredentialsHandler              func(username string, password string) (*common.UsersDetails, error)
	GetUserHandler                           func(username string) (*common.UsersDetails, error)
	ActivateUserHandler                      func(token string) error
	GetPerformanceMetricsHandler             func() (map[string]uint64, error)
	UpdatePasswordHandler                    func(username string, password string) error
	RequestEmailChangeHandler                func(username string, newEmail string, token string) error
	ConfirmEmailChangeHandler                func(token string) (string, error)
	SetCryptoPaymentIDHandler                func(username string, paymentID uint64) error
	UpdateMaxRequestsHandler                 func(username string, maxRequests uint64) error
	UpdateUserMaxRequestsFromContractHandler func(username string, contractMaxRequests uint64) error
}

StorerStub -

func (*StorerStub) ActivateUser

func (stub *StorerStub) ActivateUser(token string) error

func (*StorerStub) AddKey

func (stub *StorerStub) AddKey(username string, key string) error

func (*StorerStub) AddUser

func (stub *StorerStub) AddUser(username string, password string, isAdmin bool, maxRequests uint64, isPremium bool, isActive bool, activationToken string) error

func (*StorerStub) CheckUserCredentials

func (stub *StorerStub) CheckUserCredentials(username string, password string) (*common.UsersDetails, error)

CheckUserCredentials -

func (*StorerStub) Close

func (stub *StorerStub) Close() error

Close -

func (*StorerStub) ConfirmEmailChange

func (stub *StorerStub) ConfirmEmailChange(token string) (string, error)

func (*StorerStub) GetAllKeys

func (stub *StorerStub) GetAllKeys(username string) (map[string]common.AccessKeyDetails, error)

GetAllKeys -

func (*StorerStub) GetAllUsers

func (stub *StorerStub) GetAllUsers() (map[string]common.UsersDetails, error)

GetAllUsers -

func (*StorerStub) GetPerformanceMetrics

func (stub *StorerStub) GetPerformanceMetrics() (map[string]uint64, error)

GetPerformanceMetrics -

func (*StorerStub) GetUser

func (stub *StorerStub) GetUser(username string) (*common.UsersDetails, error)

GetUser -

func (*StorerStub) IsInterfaceNil

func (stub *StorerStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*StorerStub) IsKeyAllowed

func (stub *StorerStub) IsKeyAllowed(key string) (string, common.AccountType, error)

IsKeyAllowed -

func (*StorerStub) RemoveKey

func (stub *StorerStub) RemoveKey(username string, key string) error

RemoveKey -

func (*StorerStub) RemoveUser

func (stub *StorerStub) RemoveUser(username string) error

func (*StorerStub) RequestEmailChange

func (stub *StorerStub) RequestEmailChange(username string, newEmail string, token string) error

func (*StorerStub) SetCryptoPaymentID

func (stub *StorerStub) SetCryptoPaymentID(username string, paymentID uint64) error

func (*StorerStub) UpdateMaxRequests

func (stub *StorerStub) UpdateMaxRequests(username string, maxRequests uint64) error

func (*StorerStub) UpdatePassword

func (stub *StorerStub) UpdatePassword(username string, password string) error

func (*StorerStub) UpdateUser

func (stub *StorerStub) UpdateUser(username string, password string, isAdmin bool, maxRequests uint64, isPremium bool) error

func (*StorerStub) UpdateUserMaxRequestsFromContract

func (stub *StorerStub) UpdateUserMaxRequestsFromContract(username string, contractMaxRequests uint64) error

Jump to

Keyboard shortcuts

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