// Copyright IBM Corp. 2020, 2026 // SPDX-License-Identifier: BUSL-1.1 package perms_test import ( "context" "encoding/json" "testing" "repo.anhonesthost.net/CyberCoveLLC/threshold/internal/perms" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" // Import to trigger init() registrations in all service handlers _ "repo.anhonesthost.net/CyberCoveLLC/threshold/internal/daemon/controller/handlers/accounts" _ "repo.anhonesthost.net/CyberCoveLLC/threshold/internal/daemon/controller/handlers/aliases" _ "repo.anhonesthost.net/CyberCoveLLC/threshold/internal/daemon/controller/handlers/authmethods" _ "repo.anhonesthost.net/CyberCoveLLC/threshold/internal/daemon/controller/handlers/authtokens" _ "repo.anhonesthost.net/CyberCoveLLC/threshold/internal/daemon/controller/handlers/billing" _ "repo.anhonesthost.net/CyberCoveLLC/threshold/internal/daemon/controller/handlers/credentiallibraries" _ "repo.anhonesthost.net/CyberCoveLLC/threshold/internal/daemon/controller/handlers/credentials" _ "repo.anhonesthost.net/CyberCoveLLC/threshold/internal/daemon/controller/handlers/credentialstores" _ "repo.anhonesthost.net/CyberCoveLLC/threshold/internal/daemon/controller/handlers/groups" _ "repo.anhonesthost.net/CyberCoveLLC/threshold/internal/daemon/controller/handlers/host_catalogs" _ "repo.anhonesthost.net/CyberCoveLLC/threshold/internal/daemon/controller/handlers/host_sets" _ "repo.anhonesthost.net/CyberCoveLLC/threshold/internal/daemon/controller/handlers/hosts" _ "repo.anhonesthost.net/CyberCoveLLC/threshold/internal/daemon/controller/handlers/managed_groups" _ "repo.anhonesthost.net/CyberCoveLLC/threshold/internal/daemon/controller/handlers/policies" _ "repo.anhonesthost.net/CyberCoveLLC/threshold/internal/daemon/controller/handlers/roles" _ "repo.anhonesthost.net/CyberCoveLLC/threshold/internal/daemon/controller/handlers/scopes" _ "repo.anhonesthost.net/CyberCoveLLC/threshold/internal/daemon/controller/handlers/session_recordings" _ "repo.anhonesthost.net/CyberCoveLLC/threshold/internal/daemon/controller/handlers/sessions" _ "repo.anhonesthost.net/CyberCoveLLC/threshold/internal/daemon/controller/handlers/storage_buckets" _ "repo.anhonesthost.net/CyberCoveLLC/threshold/internal/daemon/controller/handlers/targets" _ "repo.anhonesthost.net/CyberCoveLLC/threshold/internal/daemon/controller/handlers/users" _ "repo.anhonesthost.net/CyberCoveLLC/threshold/internal/daemon/controller/handlers/workers" ) func TestBuildGrantSchema(t *testing.T) { ctx := context.Background() schema, err := perms.BuildGrantSchema(ctx) require.NoError(t, err) require.NotNil(t, schema) assert.NotEmpty(t, schema.ResourceTypes, "resource types should not be empty") // JSON serialization should produce valid JSON data, err := perms.BuildGrantSchemaJSON(ctx) require.NoError(t, err) assert.True(t, json.Valid(data), "output should be valid JSON") }