The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
grafana/pkg/services/featuremgmt/fake-token-exchange.go

23 lines
520 B

package featuremgmt
import (
"context"
"errors"
authlib "github.com/grafana/authlib/authn"
"github.com/stretchr/testify/mock"
)
type fakeTokenExchangeClient struct {
expectedErr error
*mock.Mock
}
func (c *fakeTokenExchangeClient) Exchange(ctx context.Context, r authlib.TokenExchangeRequest) (*authlib.TokenExchangeResponse, error) {
c.Called(ctx, r)
if c.expectedErr != nil {
return nil, errors.New("error signing token")
}
return &authlib.TokenExchangeResponse{Token: "signed-token"}, c.expectedErr
}