-
Notifications
You must be signed in to change notification settings - Fork 2
/
claims_test.go
44 lines (41 loc) · 1 KB
/
claims_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package multi
import (
"testing"
"time"
)
func TestNew(t *testing.T) {
t.Run("Test claims new", func(t *testing.T) {
cla := New(&Multi{
Id: uint(8457585),
Username: "username",
TenancyId: 1,
TenancyName: "username",
AuthorityIds: []string{"999"},
AuthorityType: AdminAuthority,
LoginType: LoginTypeWeb,
AuthType: LoginTypeWeb,
ExpiresAt: time.Now().Local().Add(RedisSessionTimeoutWeb).Unix(),
})
if cla == nil {
t.Error("claims init return is nil")
}
})
}
func TestValid(t *testing.T) {
t.Run("Test claims new", func(t *testing.T) {
cla := New(&Multi{
Id: uint(8457585),
Username: "username",
TenancyId: 1,
TenancyName: "username",
AuthorityIds: []string{"999"},
AuthorityType: AdminAuthority,
LoginType: LoginTypeWeb,
AuthType: LoginTypeWeb,
ExpiresAt: time.Now().Local().Add(RedisSessionTimeoutWeb).Unix(),
})
if err := cla.Valid(); err != nil {
t.Error(err)
}
})
}