go18/devcloud/mcenter/apps/policy/impl/policy_test.go
2025-06-08 17:27:04 +08:00

32 lines
561 B
Go

package impl_test
import (
"testing"
"122.51.31.227/go-course/go18/devcloud/mcenter/apps/policy"
)
func TestQueryPolicy(t *testing.T) {
req := policy.NewQueryPolicyRequest()
req.WithUser = true
req.WithRole = true
req.WithNamespace = true
set, err := impl.QueryPolicy(ctx, req)
if err != nil {
t.Fatal(err)
}
t.Log(set)
}
func TestCreatePolicy(t *testing.T) {
req := policy.NewCreatePolicyRequest()
req.SetNamespaceId(1)
req.UserId = 2
req.RoleId = 1
set, err := impl.CreatePolicy(ctx, req)
if err != nil {
t.Fatal(err)
}
t.Log(set)
}