mirror of
https://github.com/EZ-Api/ez-api.git
synced 2026-01-13 17:47:51 +00:00
feat(admin/master): provider+master CRUD, token mgmt, logs APIs
This commit is contained in:
@@ -66,3 +66,29 @@ func TestSyncProvider_WritesSnapshotAndRouting(t *testing.T) {
|
||||
t.Fatalf("expected provider id 42 in routing set %q", routeKey)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSyncKey_WritesTokenID(t *testing.T) {
|
||||
mr := miniredis.RunT(t)
|
||||
rdb := redis.NewClient(&redis.Options{Addr: mr.Addr()})
|
||||
svc := NewSyncService(rdb)
|
||||
|
||||
k := &model.Key{
|
||||
TokenHash: "hash",
|
||||
MasterID: 1,
|
||||
IssuedAtEpoch: 1,
|
||||
Status: "active",
|
||||
Group: "default",
|
||||
Scopes: "chat:write",
|
||||
DefaultNamespace: "default",
|
||||
Namespaces: "default",
|
||||
}
|
||||
k.ID = 123
|
||||
|
||||
if err := svc.SyncKey(k); err != nil {
|
||||
t.Fatalf("SyncKey: %v", err)
|
||||
}
|
||||
|
||||
if got := mr.HGet("auth:token:hash", "id"); got != "123" {
|
||||
t.Fatalf("expected auth:token:hash.id=123, got %q", got)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user