mirror of
https://github.com/grafana/grafana.git
synced 2025-01-13 09:32:12 -06:00
5fc580b401
Add testing harness
30 lines
580 B
Go
30 lines
580 B
Go
package testutil
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
"github.com/grafana/grafana/pkg/services/user"
|
|
)
|
|
|
|
func TestSignedInUser(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
r := func(user *user.SignedInUser, err error) {
|
|
require.NotNil(t, user)
|
|
require.NoError(t, err)
|
|
}
|
|
|
|
r(SignedInUser{}.NewAnonymous())
|
|
r(SignedInUser{}.NewEditor())
|
|
r(SignedInUser{}.NewGrafanaAdmin())
|
|
r(SignedInUser{}.NewEmpty())
|
|
r(SignedInUser{}.NewServiceAccount())
|
|
r(SignedInUser{}.NewViewer())
|
|
|
|
user, err := readUser(`non existent!!!`)
|
|
require.Nil(t, user)
|
|
require.Error(t, err)
|
|
}
|