-
Notifications
You must be signed in to change notification settings - Fork 4
/
path_creds_test.go
35 lines (32 loc) · 1.17 KB
/
path_creds_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
package tencentcloud
import (
"testing"
)
func TestGenerateUsername(t *testing.T) {
result := generateUsername("displayName", "roleName")
if len(result) > 64 {
t.Fatal("too long: " + result)
}
result = generateUsername("displayNamedisplayNamedisplayNamedisplayNamedisplayNamedisplayNamedisplayNamedisplayNamedisplayNamedisplayName", "roleName")
if len(result) > 64 {
t.Fatal("too long: " + result)
}
result = generateUsername("displayName", "roleNameroleNameroleNameroleNameroleNameroleNameroleNameroleNameroleNameroleName")
if len(result) > 64 {
t.Fatal("too long: " + result)
}
}
func TestGenerateRoleSessionName(t *testing.T) {
result := generateRoleSessionName("displayName", "roleName")
if len(result) > 32 {
t.Fatalf("too long: %d, %s", len(result), result)
}
result = generateRoleSessionName("displayNamedisplayNamedisplayNamedisplayNamedisplayNamedisplayNamedisplayNamedisplayNamedisplayNamedisplayName", "roleName")
if len(result) > 32 {
t.Fatal("too long: " + result)
}
result = generateRoleSessionName("displayName", "roleNameroleNameroleNameroleNameroleNameroleNameroleNameroleNameroleNameroleName")
if len(result) > 32 {
t.Fatal("too long: " + result)
}
}