统一 frontend、backend、test、test-log 和 out 目录,更新构建、部署及测试入口;纳入配置管理兼容与首次安全引导修复;排除本机配置、密钥和测试产物。
This commit is contained in:
1 parent
28cd9d3406
commit
f60d3b0880
603 files changed
+2351
-660
No files matched your search
@@ -0,0 +1,31 @@
|
||||
package session
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"git.pcux.cn/xuans/Smail/models"
|
||||
"github.com/alexedwards/scs/v2"
|
||||
)
|
||||
|
||||
func TestUserIdentityRoundTrip(t *testing.T) {
|
||||
oldInstance := Instance
|
||||
Instance = scs.New()
|
||||
t.Cleanup(func() { Instance = oldInstance })
|
||||
|
||||
loaded, err := Instance.Load(context.Background(), "")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
user := &models.User{ID: 7, Account: "admin", Name: "Admin", IsAdmin: 1, SessionVersion: 4, SecurityVersion: 3, MustChangePassword: 1}
|
||||
if err := PutUser(loaded, user); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
identity, err := GetUser(loaded)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if identity.ID != user.ID || identity.Account != user.Account || identity.Name != user.Name || identity.IsAdmin != 1 || identity.SessionVersion != 4 || identity.SecurityVersion != 3 || identity.MustChangePassword != 1 {
|
||||
t.Fatalf("unexpected session identity: %+v", identity)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user