Documentation
¶
Index ¶
- func CheckErr(e error, desc string)
- func CmpAssertEqual(t *testing.T, want interface{}, test interface{}, opts ...cmp.Option)
- func ContextGenerator(ctx context.Context, service, method, port string, req interface{}, ...) (interface{}, error)
- func LoadFromKvdb(bucketName string, key string) string
- func PrepareCtxWithToken(username string) (context.Context, context.Context)
- func SaveToKvdb(bucketName string, key string, value string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CmpAssertEqual ¶
CmpAssertEqual allows to test if two objects are equal, using go-cmp. opts refer to options to pass to the cmp.Equal() function. Can be stuff like cmpopts.IgnoreUnexported() or cmpopts.EquateErrors()
func ContextGenerator ¶
func ContextGenerator(ctx context.Context, service, method, port string, req interface{}, res interface{}) (interface{}, error)
ContextGenerator aims to create a testing context (ONLY FOR DEV AND TEST MODE). "ctx" is the context, it can contain attached metadatas. It MUST be outgoing. "service" is the name of the service, but the value has often the format "package.Service" => auth.AuthService for example. "method" is the name of the method. "port" is the port at which the services is exposed. "req" is the request, but declared like req := &authpb.CreateNewUserRequest{Username:..., Email: ...} the & is really important "res" is the response, must be like res := &authpb.CreateNewUserResponse{}, the & is really important. The res variable will be modified by reference !
func LoadFromKvdb ¶
LoadFromKvdb allows to load from the testing kvdb in one line of code
func PrepareCtxWithToken ¶
PrepareCtxWithToken returns a ctx with an embedded authorization token. First one is Incoming, second is OutGoing.
func SaveToKvdb ¶
SaveToKvdb allows to save to the testing kvdb in one line of code
Types ¶
This section is empty.