Add end-to-end tests for trust center aliases

Signed-off-by: Bryan Frimin <bryan@probo.com>
This commit is contained in:
Bryan Frimin
2026-06-22 08:40:43 +02:00
parent cd52e7fb0c
commit 9a56311d60
2 changed files with 170 additions and 0 deletions

View File

@@ -0,0 +1,54 @@
// 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_SetTrustCenterAlias(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 {
TrustCenterAlias struct {
ResourceID string `json:"resource_id"`
Alias string `json:"alias"`
} `json:"trust_center_alias"`
}
mc.CallToolInto("setTrustCenterAlias", map[string]any{
"resource_id": documentID,
"alias": "mcp-privacy-policy",
}, &result)
assert.Equal(t, documentID, result.TrustCenterAlias.ResourceID)
assert.Equal(t, "mcp-privacy-policy", result.TrustCenterAlias.Alias)
var removeResult struct {
DeletedResourceID string `json:"deleted_resource_id"`
}
mc.CallToolInto("removeTrustCenterAlias", map[string]any{
"resource_id": documentID,
}, &removeResult)
assert.Equal(t, documentID, removeResult.DeletedResourceID)
}