func newStoreServiceWithTokenCtx(initO scope.Option, tokenStoreCode string) context.Context { ctx := store.NewContextReader(context.Background(), getInitializedStoreService(initO)) tok := jwt.New(jwt.SigningMethodHS256) tok.Claims[store.ParamName] = tokenStoreCode ctx = ctxjwt.NewContext(ctx, tok) return ctx }
func TestFromContext(t *testing.T) { ctx := ctxjwt.NewContext(context.Background(), nil) assert.NotNil(t, ctx) haveToken, haveErr := ctxjwt.FromContext(ctx) assert.Nil(t, haveToken) assert.EqualError(t, haveErr, ctxjwt.ErrContextJWTNotFound.Error()) }