Files
probo/e2e/mcp/resource_alias_test.go
Bryan Frimin 79c284a894 Cover resource aliases in end-to-end tests
Replace the trust center alias console and MCP end-to-end tests with
resource alias equivalents exercising the new mutations and tools.

Signed-off-by: Bryan Frimin <bryan@probo.com>
2026-06-22 11:40:17 +02:00

55 lines
1.8 KiB
Go

// Copyright (c) 2026 Probo Inc <hello@probo.com>.
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
// OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
package mcp_test
import (
"testing"
"github.com/stretchr/testify/assert"
"go.probo.inc/probo/e2e/internal/factory"
"go.probo.inc/probo/e2e/internal/testutil"
)
func TestMCP_SetResourceAlias(t *testing.T) {
t.Parallel()
owner := testutil.NewClient(t, testutil.RoleOwner)
mc := testutil.NewMCPClient(t, owner)
documentID := factory.NewDocument(owner).WithTitle("MCP Alias Document").Create()
var result struct {
ResourceAlias struct {
ResourceID string `json:"resource_id"`
Alias string `json:"alias"`
} `json:"resource_alias"`
}
mc.CallToolInto("setResourceAlias", map[string]any{
"resource_id": documentID,
"alias": "mcp-privacy-policy",
}, &result)
assert.Equal(t, documentID, result.ResourceAlias.ResourceID)
assert.Equal(t, "mcp-privacy-policy", result.ResourceAlias.Alias)
var removeResult struct {
DeletedResourceID string `json:"deleted_resource_id"`
}
mc.CallToolInto("removeResourceAlias", map[string]any{
"resource_id": documentID,
}, &removeResult)
assert.Equal(t, documentID, removeResult.DeletedResourceID)
}