Organize backend into product executable and shared Go modules

This commit is contained in:
Stephan D committed 2026-09-12 14:14:08 +02:00
1 parent 981e84a4b4
commit f0720ec66b
382 files changed
+1944 -6989

No files matched your search

+32
View File
@@ -0,0 +1,32 @@
package model
import (
customermodel "git.sendico.io/tech/sxchnge/product/customers/model"
sessionmodel "git.sendico.io/tech/sxchnge/product/sessions/model"
"go.mongodb.org/mongo-driver/v2/bson"
"testing"
)
func TestAccountTokenPreservesSessionIdentity(t *testing.T) {
account := &customermodel.Account{}
account.SetID(bson.NewObjectID())
account.Login = "security@example.com"
account.Name = "Security"
account.Locale = "en"
session := sessionmodel.SessionIdentifier{
ClientID: "web",
DeviceID: "device-a",
SessionVersion: "session-version-a",
}
token, err := Claims2Token(Account2ClaimsForSession(account, 1, session))
if err != nil {
t.Fatalf("decode account claims: %v", err)
}
if token.SessionIdentifier != session {
t.Fatalf("session identity = %#v, want %#v", token.SessionIdentifier, session)
}
if token.Expiration.IsZero() {
t.Fatal("access token expiration is missing")
}
}