Documentation ¶
Index ¶
- type FakeExtensionImpl
- func (f *FakeExtensionImpl) AuthenticateCustomFirebaseToken(customAuthToken string) (*firebasetools.FirebaseUserTokens, error)
- func (f *FakeExtensionImpl) CreateFirebaseCustomToken(ctx context.Context, uid string) (string, error)
- func (f *FakeExtensionImpl) CreateFirebaseCustomTokenWithClaims(ctx context.Context, uid string, claims map[string]interface{}) (string, error)
- func (f *FakeExtensionImpl) EnsureSubscriptionsExist(ctx context.Context, pubsubClient *pubsub.Client, ...) error
- func (f *FakeExtensionImpl) EnsureTopicsExist(ctx context.Context, pubsubClient *pubsub.Client, topicIDs []string) error
- func (f *FakeExtensionImpl) GetLoggedInUserUID(ctx context.Context) (string, error)
- func (f *FakeExtensionImpl) LoadDepsFromYAML() (*interserviceclient.DepsConfig, error)
- func (f *FakeExtensionImpl) Login(ctx context.Context) http.HandlerFunc
- func (f *FakeExtensionImpl) MakeRequest(ctx context.Context, method string, path string, body interface{}) (*http.Response, error)
- func (f *FakeExtensionImpl) PublishToPubsub(ctx context.Context, pubsubClient *pubsub.Client, topicID string, ...) error
- func (f *FakeExtensionImpl) SetupISCclient(config interserviceclient.DepsConfig, serviceName string) (*interserviceclient.InterServiceClient, error)
- func (f *FakeExtensionImpl) VerifyPubSubJWTAndDecodePayload(w http.ResponseWriter, r *http.Request) (*pubsubtools.PubSubPayload, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FakeExtensionImpl ¶
type FakeExtensionImpl struct { MockCreateFirebaseCustomTokenFn func(ctx context.Context, uid string) (string, error) MockAuthenticateCustomFirebaseTokenFn func(customAuthToken string) (*firebasetools.FirebaseUserTokens, error) MockGetLoggedInUserUIDFn func(ctx context.Context) (string, error) MockMakeRequestFn func(ctx context.Context, method string, path string, body interface{}) (*http.Response, error) MockLoginFn func(ctx context.Context) http.HandlerFunc MockNamespacePubsubIdentifierFn func(serviceName string, topicID string, environment string, version string) string MockPublishToPubsubFn func(ctx context.Context, pubsubClient *pubsub.Client, topicID string, environment string, serviceName string, version string, payload []byte) error MockEnsureTopicsExistFn func(ctx context.Context, pubsubClient *pubsub.Client, topicIDs []string) error MockEnsureSubscriptionsExistFn func(ctx context.Context, pubsubClient *pubsub.Client, topicSubscriptionMap map[string]string, callbackURL string) error MockVerifyPubSubJWTAndDecodePayloadFn func(w http.ResponseWriter, r *http.Request) (*pubsubtools.PubSubPayload, error) MockLoadDepsFromYAMLFn func() (*interserviceclient.DepsConfig, error) MockSetupISCclientFn func(config interserviceclient.DepsConfig, serviceName string) (*interserviceclient.InterServiceClient, error) MockCreateFirebaseCustomTokenWithClaimsFn func(ctx context.Context, uid string, claims map[string]interface{}) (string, error) }
FakeExtensionImpl mocks the external calls logic
func NewFakeExtension ¶
func NewFakeExtension() *FakeExtensionImpl
NewFakeExtension initializes a new instance of the external calls mock
func (*FakeExtensionImpl) AuthenticateCustomFirebaseToken ¶
func (f *FakeExtensionImpl) AuthenticateCustomFirebaseToken(customAuthToken string) (*firebasetools.FirebaseUserTokens, error)
AuthenticateCustomFirebaseToken mocks the authenticate custom firebase token method
func (*FakeExtensionImpl) CreateFirebaseCustomToken ¶
func (f *FakeExtensionImpl) CreateFirebaseCustomToken(ctx context.Context, uid string) (string, error)
CreateFirebaseCustomToken mocks the create firebase custom token method
func (*FakeExtensionImpl) CreateFirebaseCustomTokenWithClaims ¶
func (f *FakeExtensionImpl) CreateFirebaseCustomTokenWithClaims(ctx context.Context, uid string, claims map[string]interface{}) (string, error)
CreateFirebaseCustomTokenWithClaims creates a custom auth token for the user with the indicated UID and additional claims
func (*FakeExtensionImpl) EnsureSubscriptionsExist ¶
func (f *FakeExtensionImpl) EnsureSubscriptionsExist(ctx context.Context, pubsubClient *pubsub.Client, topicSubscriptionMap map[string]string, callbackURL string) error
EnsureSubscriptionsExist ensures that the subscriptions named in the supplied topic:subscription map exist. If any does not exist, it is created.
func (*FakeExtensionImpl) EnsureTopicsExist ¶
func (f *FakeExtensionImpl) EnsureTopicsExist(ctx context.Context, pubsubClient *pubsub.Client, topicIDs []string) error
EnsureTopicsExist creates the topic(s) in the suppplied list if they do not already exist.
func (*FakeExtensionImpl) GetLoggedInUserUID ¶
func (f *FakeExtensionImpl) GetLoggedInUserUID(ctx context.Context) (string, error)
GetLoggedInUserUID mocks the implementation of getting a logged in user
func (*FakeExtensionImpl) LoadDepsFromYAML ¶
func (f *FakeExtensionImpl) LoadDepsFromYAML() (*interserviceclient.DepsConfig, error)
LoadDepsFromYAML loads the dependency config
func (*FakeExtensionImpl) Login ¶
func (f *FakeExtensionImpl) Login(ctx context.Context) http.HandlerFunc
Login mocks the login implementation to retrieve a token
func (*FakeExtensionImpl) MakeRequest ¶
func (f *FakeExtensionImpl) MakeRequest(ctx context.Context, method string, path string, body interface{}) (*http.Response, error)
MakeRequest mocks the implementation of making a http request
func (*FakeExtensionImpl) PublishToPubsub ¶
func (f *FakeExtensionImpl) PublishToPubsub(ctx context.Context, pubsubClient *pubsub.Client, topicID string, environment string, serviceName string, version string, payload []byte) error
PublishToPubsub sends the supplied payload to the indicated topic
func (*FakeExtensionImpl) SetupISCclient ¶
func (f *FakeExtensionImpl) SetupISCclient(config interserviceclient.DepsConfig, serviceName string) (*interserviceclient.InterServiceClient, error)
SetupISCclient creates an isc client
func (*FakeExtensionImpl) VerifyPubSubJWTAndDecodePayload ¶
func (f *FakeExtensionImpl) VerifyPubSubJWTAndDecodePayload(w http.ResponseWriter, r *http.Request) (*pubsubtools.PubSubPayload, error)
VerifyPubSubJWTAndDecodePayload confirms that there is a valid Google signed JWT and decodes the pubsub message payload into a struct.
It's use will simplify & shorten the handler funcs that process Cloud Pubsub push notifications.