mock

package
Version: v0.0.24 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FakeBaseExtensionImpl

type FakeBaseExtensionImpl struct {
	GetLoggedInUserFn      func(ctx context.Context) (*dto.UserInfo, error)
	GetLoggedInUserUIDFn   func(ctx context.Context) (string, error)
	NormalizeMSISDNFn      func(msisdn string) (*string, error)
	FetchDefaultCurrencyFn func(c apiclient.Client) (*apiclient.FinancialYearAndCurrency, error)
	FetchUserProfileFn     func(authClient apiclient.Client) (*profileutils.EDIUserProfile, error)
	LoginClientFn          func(username string, password string) (apiclient.Client, error)
	LoadDepsFromYAMLFn     func() (*interserviceclient.DepsConfig, error)
	SetupISCclientFn       func(config interserviceclient.DepsConfig, serviceName string) (*interserviceclient.InterServiceClient, error)
	GetEnvVarFn            func(envName string) (string, error)
	NewServerClientFn      func(
		clientID string,
		clientSecret string,
		apiTokenURL string,
		apiHost string,
		apiScheme string,
		grantType string,
		username string,
		password string,
		extraHeaders map[string]string,
	) (*apiclient.ServerClient, error)
	EnsureTopicsExistFn func(
		ctx context.Context,
		pubsubClient *pubsub.Client,
		topicIDs []string,
	) error
	GetRunningEnvironmentFn     func() string
	NamespacePubsubIdentifierFn func(
		serviceName string,
		topicID string,
		environment string,
		version string,
	) string
	PublishToPubsubFn func(
		ctx context.Context,
		pubsubClient *pubsub.Client,
		topicID string,
		environment string,
		serviceName string,
		version string,
		payload []byte,
	) error
	GoogleCloudProjectIDEnvVarNameFn func() (string, error)
	EnsureSubscriptionsExistFn       func(
		ctx context.Context,
		pubsubClient *pubsub.Client,
		topicSubscriptionMap map[string]string,
		callbackURL string,
	) error
	SubscriptionIDsFn                 func(topicIDs []string) map[string]string
	PubSubHandlerPathFn               func() string
	VerifyPubSubJWTAndDecodePayloadFn func(
		w http.ResponseWriter,
		r *http.Request,
	) (*pubsubtools.PubSubPayload, error)
	GetPubSubTopicFn    func(m *pubsubtools.PubSubPayload) (string, error)
	ErrorMapFn          func(err error) map[string]string
	WriteJSONResponseFn func(
		w http.ResponseWriter,
		source interface{},
		status int,
	)
	GetLoginFuncFn                       func(ctx context.Context) http.HandlerFunc
	GetLogoutFuncFn                      func(ctx context.Context) http.HandlerFunc
	GetRefreshFuncFn                     func() http.HandlerFunc
	GetVerifyTokenFuncFn                 func(ctx context.Context) http.HandlerFunc
	GetUserProfileByPrimaryPhoneNumberFn func(ctx context.Context, phone string, suspended bool) (*profileutils.UserProfile, error)
}

FakeBaseExtensionImpl is a `base` library fake .

func (*FakeBaseExtensionImpl) EnsureSubscriptionsExist

func (b *FakeBaseExtensionImpl) EnsureSubscriptionsExist(
	ctx context.Context,
	pubsubClient *pubsub.Client,
	topicSubscriptionMap map[string]string,
	callbackURL string,
) error

EnsureSubscriptionsExist ...

func (*FakeBaseExtensionImpl) EnsureTopicsExist

func (b *FakeBaseExtensionImpl) EnsureTopicsExist(
	ctx context.Context,
	pubsubClient *pubsub.Client,
	topicIDs []string,
) error

EnsureTopicsExist ...

func (*FakeBaseExtensionImpl) ErrorMap

func (b *FakeBaseExtensionImpl) ErrorMap(err error) map[string]string

ErrorMap ..

func (*FakeBaseExtensionImpl) FetchDefaultCurrency

FetchDefaultCurrency ...

func (*FakeBaseExtensionImpl) FetchUserProfile

func (b *FakeBaseExtensionImpl) FetchUserProfile(authClient apiclient.Client) (*profileutils.EDIUserProfile, error)

FetchUserProfile ...

func (*FakeBaseExtensionImpl) GetEnvVar

func (b *FakeBaseExtensionImpl) GetEnvVar(envName string) (string, error)

GetEnvVar ...

func (*FakeBaseExtensionImpl) GetLoggedInUser

func (b *FakeBaseExtensionImpl) GetLoggedInUser(ctx context.Context) (*dto.UserInfo, error)

GetLoggedInUser retrieves logged in user information

func (*FakeBaseExtensionImpl) GetLoggedInUserUID

func (b *FakeBaseExtensionImpl) GetLoggedInUserUID(ctx context.Context) (string, error)

GetLoggedInUserUID ...

func (*FakeBaseExtensionImpl) GetLoginFunc

func (b *FakeBaseExtensionImpl) GetLoginFunc(ctx context.Context) http.HandlerFunc

GetLoginFunc ..

func (*FakeBaseExtensionImpl) GetLogoutFunc

func (b *FakeBaseExtensionImpl) GetLogoutFunc(ctx context.Context) http.HandlerFunc

GetLogoutFunc ..

func (*FakeBaseExtensionImpl) GetPubSubTopic

func (b *FakeBaseExtensionImpl) GetPubSubTopic(m *pubsubtools.PubSubPayload) (string, error)

GetPubSubTopic ..

func (*FakeBaseExtensionImpl) GetRefreshFunc

func (b *FakeBaseExtensionImpl) GetRefreshFunc() http.HandlerFunc

GetRefreshFunc ..

func (*FakeBaseExtensionImpl) GetRunningEnvironment

func (b *FakeBaseExtensionImpl) GetRunningEnvironment() string

GetRunningEnvironment ..

func (*FakeBaseExtensionImpl) GetUserProfileByPrimaryPhoneNumber

func (b *FakeBaseExtensionImpl) GetUserProfileByPrimaryPhoneNumber(ctx context.Context, phone string, suspended bool) (*profileutils.UserProfile, error)

GetUserProfileByPrimaryPhoneNumber ..

func (*FakeBaseExtensionImpl) GetVerifyTokenFunc

func (b *FakeBaseExtensionImpl) GetVerifyTokenFunc(ctx context.Context) http.HandlerFunc

GetVerifyTokenFunc ..

func (*FakeBaseExtensionImpl) GoogleCloudProjectIDEnvVarName

func (b *FakeBaseExtensionImpl) GoogleCloudProjectIDEnvVarName() (string, error)

GoogleCloudProjectIDEnvVarName ..

func (*FakeBaseExtensionImpl) LoadDepsFromYAML

func (b *FakeBaseExtensionImpl) LoadDepsFromYAML() (*interserviceclient.DepsConfig, error)

LoadDepsFromYAML ...

func (*FakeBaseExtensionImpl) LoginClient

func (b *FakeBaseExtensionImpl) LoginClient(username, password string) (apiclient.Client, error)

LoginClient returns a logged in client with the supplied username and password

func (*FakeBaseExtensionImpl) NamespacePubsubIdentifier

func (b *FakeBaseExtensionImpl) NamespacePubsubIdentifier(
	serviceName string,
	topicID string,
	environment string,
	version string,
) string

NamespacePubsubIdentifier ..

func (*FakeBaseExtensionImpl) NewServerClient

func (b *FakeBaseExtensionImpl) NewServerClient(
	clientID string,
	clientSecret string,
	apiTokenURL string,
	apiHost string,
	apiScheme string,
	grantType string,
	username string,
	password string,
	extraHeaders map[string]string,
) (*apiclient.ServerClient, error)

NewServerClient ...

func (*FakeBaseExtensionImpl) NormalizeMSISDN

func (b *FakeBaseExtensionImpl) NormalizeMSISDN(msisdn string) (*string, error)

NormalizeMSISDN ...

func (*FakeBaseExtensionImpl) PubSubHandlerPath

func (b *FakeBaseExtensionImpl) PubSubHandlerPath() string

PubSubHandlerPath ..

func (*FakeBaseExtensionImpl) PublishToPubsub

func (b *FakeBaseExtensionImpl) PublishToPubsub(
	ctx context.Context,
	pubsubClient *pubsub.Client,
	topicID string,
	environment string,
	serviceName string,
	version string,
	payload []byte,
) error

PublishToPubsub ..

func (*FakeBaseExtensionImpl) SetupISCclient

SetupISCclient ...

func (*FakeBaseExtensionImpl) SubscriptionIDs

func (b *FakeBaseExtensionImpl) SubscriptionIDs(topicIDs []string) map[string]string

SubscriptionIDs ..

func (*FakeBaseExtensionImpl) VerifyPubSubJWTAndDecodePayload

func (b *FakeBaseExtensionImpl) VerifyPubSubJWTAndDecodePayload(
	w http.ResponseWriter,
	r *http.Request,
) (*pubsubtools.PubSubPayload, error)

VerifyPubSubJWTAndDecodePayload ..

func (*FakeBaseExtensionImpl) WriteJSONResponse

func (b *FakeBaseExtensionImpl) WriteJSONResponse(
	w http.ResponseWriter,
	source interface{},
	status int,
)

WriteJSONResponse ..

type ISCClientExtension

type ISCClientExtension struct {
	MakeRequestFn func(ctx context.Context, method string, path string, body interface{}) (*http.Response, error)
}

ISCClientExtension is an ISC fake

func (*ISCClientExtension) MakeRequest

func (i *ISCClientExtension) MakeRequest(ctx context.Context, method string, path string, body interface{}) (*http.Response, error)

MakeRequest ...

type PINExtensionImpl

type PINExtensionImpl struct {
	EncryptPINFn      func(rawPwd string, options *extension.Options) (string, string)
	ComparePINFn      func(rawPwd string, salt string, encodedPwd string, options *extension.Options) bool
	GenerateTempPINFn func(ctx context.Context) (string, error)
}

PINExtensionImpl is a `PIN` fake .

func (*PINExtensionImpl) ComparePIN

func (p *PINExtensionImpl) ComparePIN(rawPwd string, salt string, encodedPwd string, options *extension.Options) bool

ComparePIN ...

func (*PINExtensionImpl) EncryptPIN

func (p *PINExtensionImpl) EncryptPIN(rawPwd string, options *extension.Options) (string, string)

EncryptPIN ...

func (*PINExtensionImpl) GenerateTempPIN

func (p *PINExtensionImpl) GenerateTempPIN(ctx context.Context) (string, error)

GenerateTempPIN ...

Jump to

Keyboard shortcuts

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