chore: initial commit of ai site platform
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
28
platform/internal/agentcap/modpath_test.go
Normal file
28
platform/internal/agentcap/modpath_test.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package agentcap
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestSealOpenModulePath(t *testing.T) {
|
||||
secret := "test-secret"
|
||||
token, filePath, err := SealModulePath(secret, 1, 42, "settlement")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if filePath != "m/"+token {
|
||||
t.Fatalf("filePath=%s", filePath)
|
||||
}
|
||||
claim, err := OpenModulePath(secret, token)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if claim.TenantID != 1 || claim.OwnerID != 42 || claim.Slug != "settlement" {
|
||||
t.Fatalf("%+v", claim)
|
||||
}
|
||||
claim2, err := OpenModulePath(secret, filePath)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if claim2.Slug != "settlement" {
|
||||
t.Fatalf("%+v", claim2)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user