...
1 package session
2
3 import (
4 "testing"
5
6 "github.com/stretchr/testify/assert"
7
8 "edge-infra.dev/pkg/edge/api/bsl/types"
9 "edge-infra.dev/pkg/lib/uuid"
10 )
11
12 func TestNew(t *testing.T) {
13 mockSession := NewMockSessions()
14 sess := New(mockSession, 0, uuid.New().UUID)
15 assert.NotEmpty(t, sess)
16 }
17
18 func TestCreateUserSession(t *testing.T) {
19 mockSession := NewMockSessions()
20 sess := New(mockSession, 0, uuid.New().UUID)
21 assert.NotEmpty(t, sess)
22 usr := &types.AuthUser{
23 Username: "test123",
24 Email: "test@ncr.com",
25 Roles: []string{"EDGE_ORG_ADMIN"},
26 Organization: "test-org",
27 }
28 err := sess.CreateUserSession(ToUserInstance(usr))
29 assert.NoError(t, err)
30 }
31
View as plain text