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/userauth/userauthimpl/userauth_test.go

37 lines
773 B

package userauthimpl
import (
"context"
"testing"
"github.com/stretchr/testify/require"
)
func TestUserAuthService(t *testing.T) {
userAuthStore := &FakeUserAuthStore{}
userAuthService := Service{
store: userAuthStore,
}
t.Run("delete user", func(t *testing.T) {
err := userAuthService.Delete(context.Background(), 1)
require.NoError(t, err)
})
t.Run("delete token", func(t *testing.T) {
err := userAuthService.DeleteToken(context.Background(), 1)
require.NoError(t, err)
})
}
type FakeUserAuthStore struct {
ExpectedError error
}
func (f *FakeUserAuthStore) Delete(ctx context.Context, userID int64) error {
return f.ExpectedError
}
func (f *FakeUserAuthStore) DeleteToken(ctx context.Context, userID int64) error {
return f.ExpectedError
}