Add missing resources to CLI, MCP, and n8n surfaces
Audit all three API surfaces against the console GraphQL schema and add missing resources: asset, audit, datum, dpia, evidence upload, measure, obligation, processing activity, rights request, snapshot, task, tia, trust center (with references/files), and vendor management CLI commands; MCP tools for deletes, rights requests, trust center, vendor contacts/services, and compliance external URLs; n8n nodes for obligation, finding, task, evidence, processing activity, dpia, tia, rights request, snapshot, audit log, access review, organization context, trust center, and additional control/measure/vendor operations. Include MCP e2e test infrastructure (testutil MCP client with API key auth and JSON-RPC session management) and tests covering all new MCP tools. Signed-off-by: Sacha Al Himdani <sacha@getprobo.com>
This commit is contained in:
222
e2e/internal/testutil/mcp.go
Normal file
222
e2e/internal/testutil/mcp.go
Normal file
@@ -0,0 +1,222 @@
|
||||
// Copyright (c) 2025-2026 Probo Inc <hello@getprobo.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 testutil
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
// MCPClient wraps an authenticated MCP session for e2e testing.
|
||||
type MCPClient struct {
|
||||
t require.TestingT
|
||||
baseURL string
|
||||
apiToken string
|
||||
sessionID string
|
||||
httpClient *http.Client
|
||||
}
|
||||
|
||||
// CreateAPIKey creates a personal API key via the connect GraphQL API.
|
||||
// It returns the raw bearer token string.
|
||||
func (c *Client) CreateAPIKey(name string) string {
|
||||
const query = `
|
||||
mutation($input: CreatePersonalAPIKeyInput!) {
|
||||
createPersonalAPIKey(input: $input) {
|
||||
token
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
var result struct {
|
||||
CreatePersonalAPIKey struct {
|
||||
Token string `json:"token"`
|
||||
} `json:"createPersonalAPIKey"`
|
||||
}
|
||||
|
||||
err := c.ExecuteConnect(query, map[string]any{
|
||||
"input": map[string]any{
|
||||
"name": name,
|
||||
"expiresAt": time.Now().Add(1 * time.Hour).Format(time.RFC3339),
|
||||
},
|
||||
}, &result)
|
||||
require.NoError(c.T, err, "createPersonalAPIKey failed")
|
||||
require.NotEmpty(c.T, result.CreatePersonalAPIKey.Token, "API key token is empty")
|
||||
|
||||
return result.CreatePersonalAPIKey.Token
|
||||
}
|
||||
|
||||
// NewMCPClient creates an MCP client authenticated with an API key.
|
||||
// It initializes an MCP session and stores the session ID.
|
||||
func NewMCPClient(t require.TestingT, owner *Client) *MCPClient {
|
||||
token := owner.CreateAPIKey("e2e-mcp-test")
|
||||
|
||||
mc := &MCPClient{
|
||||
t: t,
|
||||
baseURL: owner.BaseURL() + "/mcp/v1",
|
||||
apiToken: token,
|
||||
httpClient: &http.Client{
|
||||
Timeout: 30 * time.Second,
|
||||
},
|
||||
}
|
||||
|
||||
mc.initialize()
|
||||
|
||||
return mc
|
||||
}
|
||||
|
||||
// jsonrpcRequest is a JSON-RPC 2.0 request.
|
||||
type jsonrpcRequest struct {
|
||||
JSONRPC string `json:"jsonrpc"`
|
||||
ID int `json:"id"`
|
||||
Method string `json:"method"`
|
||||
Params any `json:"params,omitempty"`
|
||||
}
|
||||
|
||||
// jsonrpcResponse is a JSON-RPC 2.0 response.
|
||||
type jsonrpcResponse struct {
|
||||
JSONRPC string `json:"jsonrpc"`
|
||||
ID int `json:"id"`
|
||||
Result json.RawMessage `json:"result,omitempty"`
|
||||
Error *jsonrpcError `json:"error,omitempty"`
|
||||
}
|
||||
|
||||
type jsonrpcError struct {
|
||||
Code int `json:"code"`
|
||||
Message string `json:"message"`
|
||||
}
|
||||
|
||||
func (e *jsonrpcError) Error() string {
|
||||
return fmt.Sprintf("JSON-RPC error %d: %s", e.Code, e.Message)
|
||||
}
|
||||
|
||||
func (mc *MCPClient) doRequest(method string, params any) (json.RawMessage, error) {
|
||||
reqBody := jsonrpcRequest{
|
||||
JSONRPC: "2.0",
|
||||
ID: 1,
|
||||
Method: method,
|
||||
Params: params,
|
||||
}
|
||||
|
||||
body, err := json.Marshal(reqBody)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("cannot marshal request: %w", err)
|
||||
}
|
||||
|
||||
req, err := http.NewRequest("POST", mc.baseURL, bytes.NewReader(body))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("cannot create request: %w", err)
|
||||
}
|
||||
|
||||
req.Header.Set("Content-Type", "application/json")
|
||||
req.Header.Set("Accept", "application/json, text/event-stream")
|
||||
req.Header.Set("Authorization", "Bearer "+mc.apiToken)
|
||||
if mc.sessionID != "" {
|
||||
req.Header.Set("Mcp-Session-Id", mc.sessionID)
|
||||
}
|
||||
|
||||
resp, err := mc.httpClient.Do(req)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("request failed: %w", err)
|
||||
}
|
||||
defer func() { _ = resp.Body.Close() }()
|
||||
|
||||
respBody, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("cannot read response: %w", err)
|
||||
}
|
||||
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
return nil, fmt.Errorf("unexpected status %d: %s", resp.StatusCode, string(respBody))
|
||||
}
|
||||
|
||||
// Store session ID from response
|
||||
if sid := resp.Header.Get("Mcp-Session-Id"); sid != "" {
|
||||
mc.sessionID = sid
|
||||
}
|
||||
|
||||
var rpcResp jsonrpcResponse
|
||||
if err := json.Unmarshal(respBody, &rpcResp); err != nil {
|
||||
return nil, fmt.Errorf("cannot decode response: %w (body: %s)", err, string(respBody))
|
||||
}
|
||||
|
||||
if rpcResp.Error != nil {
|
||||
return nil, rpcResp.Error
|
||||
}
|
||||
|
||||
return rpcResp.Result, nil
|
||||
}
|
||||
|
||||
func (mc *MCPClient) initialize() {
|
||||
result, err := mc.doRequest("initialize", map[string]any{
|
||||
"protocolVersion": "2025-03-26",
|
||||
"capabilities": map[string]any{},
|
||||
"clientInfo": map[string]any{
|
||||
"name": "probo-e2e-test",
|
||||
"version": "1.0.0",
|
||||
},
|
||||
})
|
||||
require.NoError(mc.t, err, "MCP initialize failed")
|
||||
require.NotNil(mc.t, result, "MCP initialize returned nil result")
|
||||
}
|
||||
|
||||
// MCPToolResult represents the result of a tools/call response.
|
||||
type MCPToolResult struct {
|
||||
Content []MCPContent `json:"content"`
|
||||
IsError bool `json:"isError"`
|
||||
}
|
||||
|
||||
// MCPContent represents content within a tool result.
|
||||
type MCPContent struct {
|
||||
Type string `json:"type"`
|
||||
Text json.RawMessage `json:"text"`
|
||||
}
|
||||
|
||||
// CallTool invokes an MCP tool and returns the parsed result.
|
||||
func (mc *MCPClient) CallTool(toolName string, args map[string]any) *MCPToolResult {
|
||||
result, err := mc.doRequest("tools/call", map[string]any{
|
||||
"name": toolName,
|
||||
"arguments": args,
|
||||
})
|
||||
require.NoError(mc.t, err, "MCP tools/call %s failed", toolName)
|
||||
|
||||
var toolResult MCPToolResult
|
||||
err = json.Unmarshal(result, &toolResult)
|
||||
require.NoError(mc.t, err, "cannot unmarshal tool result for %s", toolName)
|
||||
|
||||
return &toolResult
|
||||
}
|
||||
|
||||
// CallToolInto invokes an MCP tool and unmarshals the first text content into dest.
|
||||
func (mc *MCPClient) CallToolInto(toolName string, args map[string]any, dest any) {
|
||||
tr := mc.CallTool(toolName, args)
|
||||
require.False(mc.t, tr.IsError, "tool %s returned error: %v", toolName, tr.Content)
|
||||
require.NotEmpty(mc.t, tr.Content, "tool %s returned no content", toolName)
|
||||
|
||||
// The text field in MCP content is a JSON-encoded string of the output.
|
||||
// First unmarshal the raw JSON to get the string.
|
||||
var textStr string
|
||||
err := json.Unmarshal(tr.Content[0].Text, &textStr)
|
||||
require.NoError(mc.t, err, "cannot unmarshal text content for %s", toolName)
|
||||
|
||||
// Then unmarshal that string as JSON into the destination.
|
||||
err = json.Unmarshal([]byte(textStr), dest)
|
||||
require.NoError(mc.t, err, "cannot unmarshal tool output for %s", toolName)
|
||||
}
|
||||
95
e2e/mcp/asset_test.go
Normal file
95
e2e/mcp/asset_test.go
Normal file
@@ -0,0 +1,95 @@
|
||||
// Copyright (c) 2025-2026 Probo Inc <hello@getprobo.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"
|
||||
"github.com/stretchr/testify/require"
|
||||
"go.probo.inc/probo/e2e/internal/factory"
|
||||
"go.probo.inc/probo/e2e/internal/testutil"
|
||||
)
|
||||
|
||||
func TestMCP_Asset_CRUD(t *testing.T) {
|
||||
t.Parallel()
|
||||
owner := testutil.NewClient(t, testutil.RoleOwner)
|
||||
mc := testutil.NewMCPClient(t, owner)
|
||||
orgID := owner.GetOrganizationID().String()
|
||||
profileID := factory.CreateUser(owner)
|
||||
|
||||
// Create
|
||||
var addResult struct {
|
||||
Asset struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
AssetType string `json:"assetType"`
|
||||
} `json:"asset"`
|
||||
}
|
||||
mc.CallToolInto("addAsset", map[string]any{
|
||||
"organizationId": orgID,
|
||||
"name": factory.SafeName("Asset"),
|
||||
"amount": 5,
|
||||
"ownerId": profileID,
|
||||
"assetType": "VIRTUAL",
|
||||
"dataTypesStored": "PII",
|
||||
}, &addResult)
|
||||
require.NotEmpty(t, addResult.Asset.ID)
|
||||
assert.Equal(t, "VIRTUAL", addResult.Asset.AssetType)
|
||||
|
||||
// Get
|
||||
var getResult struct {
|
||||
Asset struct {
|
||||
ID string `json:"id"`
|
||||
} `json:"asset"`
|
||||
}
|
||||
mc.CallToolInto("getAsset", map[string]any{
|
||||
"id": addResult.Asset.ID,
|
||||
}, &getResult)
|
||||
assert.Equal(t, addResult.Asset.ID, getResult.Asset.ID)
|
||||
|
||||
// Update
|
||||
var updateResult struct {
|
||||
Asset struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
} `json:"asset"`
|
||||
}
|
||||
mc.CallToolInto("updateAsset", map[string]any{
|
||||
"id": addResult.Asset.ID,
|
||||
"name": "Updated Asset",
|
||||
}, &updateResult)
|
||||
assert.Equal(t, "Updated Asset", updateResult.Asset.Name)
|
||||
|
||||
// List
|
||||
var listResult struct {
|
||||
Assets []struct {
|
||||
ID string `json:"id"`
|
||||
} `json:"assets"`
|
||||
}
|
||||
mc.CallToolInto("listAssets", map[string]any{
|
||||
"organizationId": orgID,
|
||||
}, &listResult)
|
||||
assert.NotEmpty(t, listResult.Assets)
|
||||
|
||||
// Delete
|
||||
var deleteResult struct {
|
||||
DeletedAssetID string `json:"deletedAssetId"`
|
||||
}
|
||||
mc.CallToolInto("deleteAsset", map[string]any{
|
||||
"id": addResult.Asset.ID,
|
||||
}, &deleteResult)
|
||||
assert.Equal(t, addResult.Asset.ID, deleteResult.DeletedAssetID)
|
||||
}
|
||||
109
e2e/mcp/audit_test.go
Normal file
109
e2e/mcp/audit_test.go
Normal file
@@ -0,0 +1,109 @@
|
||||
// Copyright (c) 2025-2026 Probo Inc <hello@getprobo.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"
|
||||
"github.com/stretchr/testify/require"
|
||||
"go.probo.inc/probo/e2e/internal/factory"
|
||||
"go.probo.inc/probo/e2e/internal/testutil"
|
||||
)
|
||||
|
||||
func TestMCP_Audit_CRUD(t *testing.T) {
|
||||
t.Parallel()
|
||||
owner := testutil.NewClient(t, testutil.RoleOwner)
|
||||
mc := testutil.NewMCPClient(t, owner)
|
||||
orgID := owner.GetOrganizationID().String()
|
||||
frameworkID := factory.CreateFramework(owner)
|
||||
|
||||
// Create
|
||||
var addResult struct {
|
||||
Audit struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
} `json:"audit"`
|
||||
}
|
||||
mc.CallToolInto("addAudit", map[string]any{
|
||||
"frameworkId": frameworkID,
|
||||
"name": factory.SafeName("Audit"),
|
||||
}, &addResult)
|
||||
require.NotEmpty(t, addResult.Audit.ID)
|
||||
|
||||
// Get
|
||||
var getResult struct {
|
||||
Audit struct {
|
||||
ID string `json:"id"`
|
||||
} `json:"audit"`
|
||||
}
|
||||
mc.CallToolInto("getAudit", map[string]any{
|
||||
"id": addResult.Audit.ID,
|
||||
}, &getResult)
|
||||
assert.Equal(t, addResult.Audit.ID, getResult.Audit.ID)
|
||||
|
||||
// Update
|
||||
var updateResult struct {
|
||||
Audit struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
} `json:"audit"`
|
||||
}
|
||||
mc.CallToolInto("updateAudit", map[string]any{
|
||||
"id": addResult.Audit.ID,
|
||||
"name": "Updated Audit",
|
||||
}, &updateResult)
|
||||
assert.Equal(t, "Updated Audit", updateResult.Audit.Name)
|
||||
|
||||
// List
|
||||
var listResult struct {
|
||||
Audits []struct {
|
||||
ID string `json:"id"`
|
||||
} `json:"audits"`
|
||||
}
|
||||
mc.CallToolInto("listAudits", map[string]any{
|
||||
"organizationId": orgID,
|
||||
}, &listResult)
|
||||
assert.NotEmpty(t, listResult.Audits)
|
||||
|
||||
// Delete
|
||||
var deleteResult struct {
|
||||
DeletedAuditID string `json:"deletedAuditId"`
|
||||
}
|
||||
mc.CallToolInto("deleteAudit", map[string]any{
|
||||
"id": addResult.Audit.ID,
|
||||
}, &deleteResult)
|
||||
assert.Equal(t, addResult.Audit.ID, deleteResult.DeletedAuditID)
|
||||
}
|
||||
|
||||
func TestMCP_AuditLog(t *testing.T) {
|
||||
t.Parallel()
|
||||
owner := testutil.NewClient(t, testutil.RoleOwner)
|
||||
mc := testutil.NewMCPClient(t, owner)
|
||||
orgID := owner.GetOrganizationID().String()
|
||||
|
||||
// Creating something generates audit log entries
|
||||
factory.CreateVendor(owner)
|
||||
|
||||
var listResult struct {
|
||||
AuditLogEntries []struct {
|
||||
ID string `json:"id"`
|
||||
} `json:"auditLogEntries"`
|
||||
}
|
||||
mc.CallToolInto("listAuditLogEntries", map[string]any{
|
||||
"organizationId": orgID,
|
||||
}, &listResult)
|
||||
assert.NotEmpty(t, listResult.AuditLogEntries)
|
||||
}
|
||||
91
e2e/mcp/datum_test.go
Normal file
91
e2e/mcp/datum_test.go
Normal file
@@ -0,0 +1,91 @@
|
||||
// Copyright (c) 2025-2026 Probo Inc <hello@getprobo.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"
|
||||
"github.com/stretchr/testify/require"
|
||||
"go.probo.inc/probo/e2e/internal/factory"
|
||||
"go.probo.inc/probo/e2e/internal/testutil"
|
||||
)
|
||||
|
||||
func TestMCP_Datum_CRUD(t *testing.T) {
|
||||
t.Parallel()
|
||||
owner := testutil.NewClient(t, testutil.RoleOwner)
|
||||
mc := testutil.NewMCPClient(t, owner)
|
||||
orgID := owner.GetOrganizationID().String()
|
||||
profileID := factory.CreateUser(owner)
|
||||
|
||||
// Create
|
||||
var addResult struct {
|
||||
Datum struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
} `json:"datum"`
|
||||
}
|
||||
mc.CallToolInto("addDatum", map[string]any{
|
||||
"organizationId": orgID,
|
||||
"name": factory.SafeName("Datum"),
|
||||
"ownerId": profileID,
|
||||
"dataClassification": "PUBLIC",
|
||||
}, &addResult)
|
||||
require.NotEmpty(t, addResult.Datum.ID)
|
||||
|
||||
// Get
|
||||
var getResult struct {
|
||||
Datum struct {
|
||||
ID string `json:"id"`
|
||||
} `json:"datum"`
|
||||
}
|
||||
mc.CallToolInto("getDatum", map[string]any{
|
||||
"id": addResult.Datum.ID,
|
||||
}, &getResult)
|
||||
assert.Equal(t, addResult.Datum.ID, getResult.Datum.ID)
|
||||
|
||||
// Update
|
||||
var updateResult struct {
|
||||
Datum struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
} `json:"datum"`
|
||||
}
|
||||
mc.CallToolInto("updateDatum", map[string]any{
|
||||
"id": addResult.Datum.ID,
|
||||
"name": "Updated Datum",
|
||||
}, &updateResult)
|
||||
assert.Equal(t, "Updated Datum", updateResult.Datum.Name)
|
||||
|
||||
// List
|
||||
var listResult struct {
|
||||
Data []struct {
|
||||
ID string `json:"id"`
|
||||
} `json:"data"`
|
||||
}
|
||||
mc.CallToolInto("listData", map[string]any{
|
||||
"organizationId": orgID,
|
||||
}, &listResult)
|
||||
assert.NotEmpty(t, listResult.Data)
|
||||
|
||||
// Delete
|
||||
var deleteResult struct {
|
||||
DeletedDatumID string `json:"deletedDatumId"`
|
||||
}
|
||||
mc.CallToolInto("deleteDatum", map[string]any{
|
||||
"id": addResult.Datum.ID,
|
||||
}, &deleteResult)
|
||||
assert.Equal(t, addResult.Datum.ID, deleteResult.DeletedDatumID)
|
||||
}
|
||||
89
e2e/mcp/document_test.go
Normal file
89
e2e/mcp/document_test.go
Normal file
@@ -0,0 +1,89 @@
|
||||
// Copyright (c) 2025-2026 Probo Inc <hello@getprobo.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"
|
||||
"github.com/stretchr/testify/require"
|
||||
"go.probo.inc/probo/e2e/internal/factory"
|
||||
"go.probo.inc/probo/e2e/internal/testutil"
|
||||
)
|
||||
|
||||
func TestMCP_Document_CRUD(t *testing.T) {
|
||||
t.Parallel()
|
||||
owner := testutil.NewClient(t, testutil.RoleOwner)
|
||||
mc := testutil.NewMCPClient(t, owner)
|
||||
orgID := owner.GetOrganizationID().String()
|
||||
|
||||
// Create
|
||||
var addResult struct {
|
||||
Document struct {
|
||||
ID string `json:"id"`
|
||||
Title string `json:"title"`
|
||||
} `json:"document"`
|
||||
}
|
||||
mc.CallToolInto("addDocument", map[string]any{
|
||||
"organizationId": orgID,
|
||||
"title": factory.SafeName("Document"),
|
||||
"documentType": "POLICY",
|
||||
}, &addResult)
|
||||
require.NotEmpty(t, addResult.Document.ID)
|
||||
|
||||
// Get
|
||||
var getResult struct {
|
||||
Document struct {
|
||||
ID string `json:"id"`
|
||||
} `json:"document"`
|
||||
}
|
||||
mc.CallToolInto("getDocument", map[string]any{
|
||||
"id": addResult.Document.ID,
|
||||
}, &getResult)
|
||||
assert.Equal(t, addResult.Document.ID, getResult.Document.ID)
|
||||
|
||||
// Update
|
||||
var updateResult struct {
|
||||
Document struct {
|
||||
ID string `json:"id"`
|
||||
Title string `json:"title"`
|
||||
} `json:"document"`
|
||||
}
|
||||
mc.CallToolInto("updateDocument", map[string]any{
|
||||
"id": addResult.Document.ID,
|
||||
"title": "Updated Document",
|
||||
}, &updateResult)
|
||||
assert.Equal(t, "Updated Document", updateResult.Document.Title)
|
||||
|
||||
// List
|
||||
var listResult struct {
|
||||
Documents []struct {
|
||||
ID string `json:"id"`
|
||||
} `json:"documents"`
|
||||
}
|
||||
mc.CallToolInto("listDocuments", map[string]any{
|
||||
"organizationId": orgID,
|
||||
}, &listResult)
|
||||
assert.NotEmpty(t, listResult.Documents)
|
||||
|
||||
// Delete
|
||||
var deleteResult struct {
|
||||
DeletedDocumentID string `json:"deletedDocumentId"`
|
||||
}
|
||||
mc.CallToolInto("deleteDocument", map[string]any{
|
||||
"id": addResult.Document.ID,
|
||||
}, &deleteResult)
|
||||
assert.Equal(t, addResult.Document.ID, deleteResult.DeletedDocumentID)
|
||||
}
|
||||
152
e2e/mcp/dpia_tia_test.go
Normal file
152
e2e/mcp/dpia_tia_test.go
Normal file
@@ -0,0 +1,152 @@
|
||||
// Copyright (c) 2025-2026 Probo Inc <hello@getprobo.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"
|
||||
"github.com/stretchr/testify/require"
|
||||
"go.probo.inc/probo/e2e/internal/factory"
|
||||
"go.probo.inc/probo/e2e/internal/testutil"
|
||||
)
|
||||
|
||||
func TestMCP_DPIA_CRUD(t *testing.T) {
|
||||
t.Parallel()
|
||||
owner := testutil.NewClient(t, testutil.RoleOwner)
|
||||
mc := testutil.NewMCPClient(t, owner)
|
||||
orgID := owner.GetOrganizationID().String()
|
||||
|
||||
paID := factory.CreateProcessingActivity(owner)
|
||||
|
||||
// Create
|
||||
var addResult struct {
|
||||
DataProtectionImpactAssessment struct {
|
||||
ID string `json:"id"`
|
||||
} `json:"dataProtectionImpactAssessment"`
|
||||
}
|
||||
mc.CallToolInto("addDataProtectionImpactAssessment", map[string]any{
|
||||
"processingActivityId": paID,
|
||||
}, &addResult)
|
||||
require.NotEmpty(t, addResult.DataProtectionImpactAssessment.ID)
|
||||
|
||||
// Get
|
||||
var getResult struct {
|
||||
DataProtectionImpactAssessment struct {
|
||||
ID string `json:"id"`
|
||||
} `json:"dataProtectionImpactAssessment"`
|
||||
}
|
||||
mc.CallToolInto("getDataProtectionImpactAssessment", map[string]any{
|
||||
"id": addResult.DataProtectionImpactAssessment.ID,
|
||||
}, &getResult)
|
||||
assert.Equal(t, addResult.DataProtectionImpactAssessment.ID, getResult.DataProtectionImpactAssessment.ID)
|
||||
|
||||
// Update
|
||||
var updateResult struct {
|
||||
DataProtectionImpactAssessment struct {
|
||||
ID string `json:"id"`
|
||||
Description string `json:"description"`
|
||||
} `json:"dataProtectionImpactAssessment"`
|
||||
}
|
||||
mc.CallToolInto("updateDataProtectionImpactAssessment", map[string]any{
|
||||
"id": addResult.DataProtectionImpactAssessment.ID,
|
||||
"description": "Updated DPIA",
|
||||
}, &updateResult)
|
||||
assert.Equal(t, "Updated DPIA", updateResult.DataProtectionImpactAssessment.Description)
|
||||
|
||||
// List
|
||||
var listResult struct {
|
||||
DataProtectionImpactAssessments []struct {
|
||||
ID string `json:"id"`
|
||||
} `json:"dataProtectionImpactAssessments"`
|
||||
}
|
||||
mc.CallToolInto("listDataProtectionImpactAssessments", map[string]any{
|
||||
"organizationId": orgID,
|
||||
}, &listResult)
|
||||
assert.NotEmpty(t, listResult.DataProtectionImpactAssessments)
|
||||
|
||||
// Delete
|
||||
var deleteResult struct {
|
||||
DeletedDataProtectionImpactAssessmentID string `json:"deletedDataProtectionImpactAssessmentId"`
|
||||
}
|
||||
mc.CallToolInto("deleteDataProtectionImpactAssessment", map[string]any{
|
||||
"id": addResult.DataProtectionImpactAssessment.ID,
|
||||
}, &deleteResult)
|
||||
assert.Equal(t, addResult.DataProtectionImpactAssessment.ID, deleteResult.DeletedDataProtectionImpactAssessmentID)
|
||||
}
|
||||
|
||||
func TestMCP_TIA_CRUD(t *testing.T) {
|
||||
t.Parallel()
|
||||
owner := testutil.NewClient(t, testutil.RoleOwner)
|
||||
mc := testutil.NewMCPClient(t, owner)
|
||||
orgID := owner.GetOrganizationID().String()
|
||||
|
||||
paID := factory.CreateProcessingActivity(owner)
|
||||
|
||||
// Create
|
||||
var addResult struct {
|
||||
TransferImpactAssessment struct {
|
||||
ID string `json:"id"`
|
||||
} `json:"transferImpactAssessment"`
|
||||
}
|
||||
mc.CallToolInto("addTransferImpactAssessment", map[string]any{
|
||||
"processingActivityId": paID,
|
||||
}, &addResult)
|
||||
require.NotEmpty(t, addResult.TransferImpactAssessment.ID)
|
||||
|
||||
// Get
|
||||
var getResult struct {
|
||||
TransferImpactAssessment struct {
|
||||
ID string `json:"id"`
|
||||
} `json:"transferImpactAssessment"`
|
||||
}
|
||||
mc.CallToolInto("getTransferImpactAssessment", map[string]any{
|
||||
"id": addResult.TransferImpactAssessment.ID,
|
||||
}, &getResult)
|
||||
assert.Equal(t, addResult.TransferImpactAssessment.ID, getResult.TransferImpactAssessment.ID)
|
||||
|
||||
// Update
|
||||
var updateResult struct {
|
||||
TransferImpactAssessment struct {
|
||||
ID string `json:"id"`
|
||||
DataSubjects string `json:"dataSubjects"`
|
||||
} `json:"transferImpactAssessment"`
|
||||
}
|
||||
mc.CallToolInto("updateTransferImpactAssessment", map[string]any{
|
||||
"id": addResult.TransferImpactAssessment.ID,
|
||||
"dataSubjects": "EU Residents",
|
||||
}, &updateResult)
|
||||
assert.Equal(t, "EU Residents", updateResult.TransferImpactAssessment.DataSubjects)
|
||||
|
||||
// List
|
||||
var listResult struct {
|
||||
TransferImpactAssessments []struct {
|
||||
ID string `json:"id"`
|
||||
} `json:"transferImpactAssessments"`
|
||||
}
|
||||
mc.CallToolInto("listTransferImpactAssessments", map[string]any{
|
||||
"organizationId": orgID,
|
||||
}, &listResult)
|
||||
assert.NotEmpty(t, listResult.TransferImpactAssessments)
|
||||
|
||||
// Delete
|
||||
var deleteResult struct {
|
||||
DeletedTransferImpactAssessmentID string `json:"deletedTransferImpactAssessmentId"`
|
||||
}
|
||||
mc.CallToolInto("deleteTransferImpactAssessment", map[string]any{
|
||||
"id": addResult.TransferImpactAssessment.ID,
|
||||
}, &deleteResult)
|
||||
assert.Equal(t, addResult.TransferImpactAssessment.ID, deleteResult.DeletedTransferImpactAssessmentID)
|
||||
}
|
||||
88
e2e/mcp/finding_test.go
Normal file
88
e2e/mcp/finding_test.go
Normal file
@@ -0,0 +1,88 @@
|
||||
// Copyright (c) 2025-2026 Probo Inc <hello@getprobo.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"
|
||||
"github.com/stretchr/testify/require"
|
||||
"go.probo.inc/probo/e2e/internal/factory"
|
||||
"go.probo.inc/probo/e2e/internal/testutil"
|
||||
)
|
||||
|
||||
func TestMCP_Finding_CRUD(t *testing.T) {
|
||||
t.Parallel()
|
||||
owner := testutil.NewClient(t, testutil.RoleOwner)
|
||||
mc := testutil.NewMCPClient(t, owner)
|
||||
orgID := owner.GetOrganizationID().String()
|
||||
|
||||
// Create
|
||||
var addResult struct {
|
||||
Finding struct {
|
||||
ID string `json:"id"`
|
||||
Title string `json:"title"`
|
||||
} `json:"finding"`
|
||||
}
|
||||
mc.CallToolInto("addFinding", map[string]any{
|
||||
"organizationId": orgID,
|
||||
"title": factory.SafeName("Finding"),
|
||||
}, &addResult)
|
||||
require.NotEmpty(t, addResult.Finding.ID)
|
||||
|
||||
// Get
|
||||
var getResult struct {
|
||||
Finding struct {
|
||||
ID string `json:"id"`
|
||||
} `json:"finding"`
|
||||
}
|
||||
mc.CallToolInto("getFinding", map[string]any{
|
||||
"id": addResult.Finding.ID,
|
||||
}, &getResult)
|
||||
assert.Equal(t, addResult.Finding.ID, getResult.Finding.ID)
|
||||
|
||||
// Update
|
||||
var updateResult struct {
|
||||
Finding struct {
|
||||
ID string `json:"id"`
|
||||
Title string `json:"title"`
|
||||
} `json:"finding"`
|
||||
}
|
||||
mc.CallToolInto("updateFinding", map[string]any{
|
||||
"id": addResult.Finding.ID,
|
||||
"title": "Updated Finding",
|
||||
}, &updateResult)
|
||||
assert.Equal(t, "Updated Finding", updateResult.Finding.Title)
|
||||
|
||||
// List
|
||||
var listResult struct {
|
||||
Findings []struct {
|
||||
ID string `json:"id"`
|
||||
} `json:"findings"`
|
||||
}
|
||||
mc.CallToolInto("listFindings", map[string]any{
|
||||
"organizationId": orgID,
|
||||
}, &listResult)
|
||||
assert.NotEmpty(t, listResult.Findings)
|
||||
|
||||
// Delete
|
||||
var deleteResult struct {
|
||||
DeletedFindingID string `json:"deletedFindingId"`
|
||||
}
|
||||
mc.CallToolInto("deleteFinding", map[string]any{
|
||||
"id": addResult.Finding.ID,
|
||||
}, &deleteResult)
|
||||
assert.Equal(t, addResult.Finding.ID, deleteResult.DeletedFindingID)
|
||||
}
|
||||
135
e2e/mcp/framework_test.go
Normal file
135
e2e/mcp/framework_test.go
Normal file
@@ -0,0 +1,135 @@
|
||||
// Copyright (c) 2025-2026 Probo Inc <hello@getprobo.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"
|
||||
"github.com/stretchr/testify/require"
|
||||
"go.probo.inc/probo/e2e/internal/factory"
|
||||
"go.probo.inc/probo/e2e/internal/testutil"
|
||||
)
|
||||
|
||||
func TestMCP_Framework_CRUD(t *testing.T) {
|
||||
t.Parallel()
|
||||
owner := testutil.NewClient(t, testutil.RoleOwner)
|
||||
mc := testutil.NewMCPClient(t, owner)
|
||||
orgID := owner.GetOrganizationID().String()
|
||||
|
||||
// Create
|
||||
var addResult struct {
|
||||
Framework struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
} `json:"framework"`
|
||||
}
|
||||
mc.CallToolInto("addFramework", map[string]any{
|
||||
"organizationId": orgID,
|
||||
"name": factory.SafeName("Framework"),
|
||||
}, &addResult)
|
||||
require.NotEmpty(t, addResult.Framework.ID)
|
||||
|
||||
// Get
|
||||
var getResult struct {
|
||||
Framework struct {
|
||||
ID string `json:"id"`
|
||||
} `json:"framework"`
|
||||
}
|
||||
mc.CallToolInto("getFramework", map[string]any{
|
||||
"id": addResult.Framework.ID,
|
||||
}, &getResult)
|
||||
assert.Equal(t, addResult.Framework.ID, getResult.Framework.ID)
|
||||
|
||||
// Update
|
||||
var updateResult struct {
|
||||
Framework struct {
|
||||
ID string `json:"id"`
|
||||
Description string `json:"description"`
|
||||
} `json:"framework"`
|
||||
}
|
||||
mc.CallToolInto("updateFramework", map[string]any{
|
||||
"id": addResult.Framework.ID,
|
||||
"description": "Updated description",
|
||||
}, &updateResult)
|
||||
assert.Equal(t, "Updated description", updateResult.Framework.Description)
|
||||
|
||||
// List
|
||||
var listResult struct {
|
||||
Frameworks []struct {
|
||||
ID string `json:"id"`
|
||||
} `json:"frameworks"`
|
||||
}
|
||||
mc.CallToolInto("listFrameworks", map[string]any{
|
||||
"organizationId": orgID,
|
||||
}, &listResult)
|
||||
assert.NotEmpty(t, listResult.Frameworks)
|
||||
}
|
||||
|
||||
func TestMCP_Control_CRUD(t *testing.T) {
|
||||
t.Parallel()
|
||||
owner := testutil.NewClient(t, testutil.RoleOwner)
|
||||
mc := testutil.NewMCPClient(t, owner)
|
||||
|
||||
frameworkID := factory.CreateFramework(owner)
|
||||
|
||||
// Create
|
||||
var addResult struct {
|
||||
Control struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
} `json:"control"`
|
||||
}
|
||||
mc.CallToolInto("addControl", map[string]any{
|
||||
"frameworkId": frameworkID,
|
||||
"name": factory.SafeName("Control"),
|
||||
}, &addResult)
|
||||
require.NotEmpty(t, addResult.Control.ID)
|
||||
|
||||
// Get
|
||||
var getResult struct {
|
||||
Control struct {
|
||||
ID string `json:"id"`
|
||||
} `json:"control"`
|
||||
}
|
||||
mc.CallToolInto("getControl", map[string]any{
|
||||
"id": addResult.Control.ID,
|
||||
}, &getResult)
|
||||
assert.Equal(t, addResult.Control.ID, getResult.Control.ID)
|
||||
|
||||
// Update
|
||||
var updateResult struct {
|
||||
Control struct {
|
||||
ID string `json:"id"`
|
||||
Description string `json:"description"`
|
||||
} `json:"control"`
|
||||
}
|
||||
mc.CallToolInto("updateControl", map[string]any{
|
||||
"id": addResult.Control.ID,
|
||||
"description": "Updated control",
|
||||
}, &updateResult)
|
||||
assert.Equal(t, "Updated control", updateResult.Control.Description)
|
||||
|
||||
// List
|
||||
var listResult struct {
|
||||
Controls []struct {
|
||||
ID string `json:"id"`
|
||||
} `json:"controls"`
|
||||
}
|
||||
mc.CallToolInto("listControls", map[string]any{
|
||||
"frameworkId": frameworkID,
|
||||
}, &listResult)
|
||||
assert.NotEmpty(t, listResult.Controls)
|
||||
}
|
||||
29
e2e/mcp/main_test.go
Normal file
29
e2e/mcp/main_test.go
Normal file
@@ -0,0 +1,29 @@
|
||||
// Copyright (c) 2025-2026 Probo Inc <hello@getprobo.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 (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"go.probo.inc/probo/e2e/internal/testutil"
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
testutil.Setup()
|
||||
code := m.Run()
|
||||
testutil.Teardown()
|
||||
os.Exit(code)
|
||||
}
|
||||
110
e2e/mcp/measure_test.go
Normal file
110
e2e/mcp/measure_test.go
Normal file
@@ -0,0 +1,110 @@
|
||||
// Copyright (c) 2025-2026 Probo Inc <hello@getprobo.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"
|
||||
"github.com/stretchr/testify/require"
|
||||
"go.probo.inc/probo/e2e/internal/factory"
|
||||
"go.probo.inc/probo/e2e/internal/testutil"
|
||||
)
|
||||
|
||||
func TestMCP_Measure_CRUD(t *testing.T) {
|
||||
t.Parallel()
|
||||
owner := testutil.NewClient(t, testutil.RoleOwner)
|
||||
mc := testutil.NewMCPClient(t, owner)
|
||||
orgID := owner.GetOrganizationID().String()
|
||||
|
||||
// Create
|
||||
var addResult struct {
|
||||
Measure struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
} `json:"measure"`
|
||||
}
|
||||
mc.CallToolInto("addMeasure", map[string]any{
|
||||
"organizationId": orgID,
|
||||
"name": factory.SafeName("Measure"),
|
||||
}, &addResult)
|
||||
require.NotEmpty(t, addResult.Measure.ID)
|
||||
|
||||
// Get
|
||||
var getResult struct {
|
||||
Measure struct {
|
||||
ID string `json:"id"`
|
||||
} `json:"measure"`
|
||||
}
|
||||
mc.CallToolInto("getMeasure", map[string]any{
|
||||
"id": addResult.Measure.ID,
|
||||
}, &getResult)
|
||||
assert.Equal(t, addResult.Measure.ID, getResult.Measure.ID)
|
||||
|
||||
// Update
|
||||
var updateResult struct {
|
||||
Measure struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
} `json:"measure"`
|
||||
}
|
||||
mc.CallToolInto("updateMeasure", map[string]any{
|
||||
"id": addResult.Measure.ID,
|
||||
"name": "Updated Measure",
|
||||
}, &updateResult)
|
||||
assert.Equal(t, "Updated Measure", updateResult.Measure.Name)
|
||||
|
||||
// List
|
||||
var listResult struct {
|
||||
Measures []struct {
|
||||
ID string `json:"id"`
|
||||
} `json:"measures"`
|
||||
}
|
||||
mc.CallToolInto("listMeasures", map[string]any{
|
||||
"organizationId": orgID,
|
||||
}, &listResult)
|
||||
assert.NotEmpty(t, listResult.Measures)
|
||||
|
||||
// Sub-resources (empty lists are fine, just verify the tools work)
|
||||
var risksResult struct {
|
||||
Risks []struct{ ID string } `json:"risks"`
|
||||
}
|
||||
mc.CallToolInto("listMeasureRisks", map[string]any{
|
||||
"measureId": addResult.Measure.ID,
|
||||
}, &risksResult)
|
||||
|
||||
var controlsResult struct {
|
||||
Controls []struct{ ID string } `json:"controls"`
|
||||
}
|
||||
mc.CallToolInto("listMeasureControls", map[string]any{
|
||||
"measureId": addResult.Measure.ID,
|
||||
}, &controlsResult)
|
||||
|
||||
var tasksResult struct {
|
||||
Tasks []struct{ ID string } `json:"tasks"`
|
||||
}
|
||||
mc.CallToolInto("listMeasureTasks", map[string]any{
|
||||
"measureId": addResult.Measure.ID,
|
||||
}, &tasksResult)
|
||||
|
||||
// Delete
|
||||
var deleteResult struct {
|
||||
DeletedMeasureID string `json:"deletedMeasureId"`
|
||||
}
|
||||
mc.CallToolInto("deleteMeasure", map[string]any{
|
||||
"id": addResult.Measure.ID,
|
||||
}, &deleteResult)
|
||||
assert.Equal(t, addResult.Measure.ID, deleteResult.DeletedMeasureID)
|
||||
}
|
||||
89
e2e/mcp/obligation_test.go
Normal file
89
e2e/mcp/obligation_test.go
Normal file
@@ -0,0 +1,89 @@
|
||||
// Copyright (c) 2025-2026 Probo Inc <hello@getprobo.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"
|
||||
"github.com/stretchr/testify/require"
|
||||
"go.probo.inc/probo/e2e/internal/factory"
|
||||
"go.probo.inc/probo/e2e/internal/testutil"
|
||||
)
|
||||
|
||||
func TestMCP_Obligation_CRUD(t *testing.T) {
|
||||
t.Parallel()
|
||||
owner := testutil.NewClient(t, testutil.RoleOwner)
|
||||
mc := testutil.NewMCPClient(t, owner)
|
||||
orgID := owner.GetOrganizationID().String()
|
||||
|
||||
// Create
|
||||
var addResult struct {
|
||||
Obligation struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
} `json:"obligation"`
|
||||
}
|
||||
mc.CallToolInto("addObligation", map[string]any{
|
||||
"organizationId": orgID,
|
||||
"name": factory.SafeName("Obligation"),
|
||||
"description": "Test obligation",
|
||||
}, &addResult)
|
||||
require.NotEmpty(t, addResult.Obligation.ID)
|
||||
|
||||
// Get
|
||||
var getResult struct {
|
||||
Obligation struct {
|
||||
ID string `json:"id"`
|
||||
} `json:"obligation"`
|
||||
}
|
||||
mc.CallToolInto("getObligation", map[string]any{
|
||||
"id": addResult.Obligation.ID,
|
||||
}, &getResult)
|
||||
assert.Equal(t, addResult.Obligation.ID, getResult.Obligation.ID)
|
||||
|
||||
// Update
|
||||
var updateResult struct {
|
||||
Obligation struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
} `json:"obligation"`
|
||||
}
|
||||
mc.CallToolInto("updateObligation", map[string]any{
|
||||
"id": addResult.Obligation.ID,
|
||||
"name": "Updated Obligation",
|
||||
}, &updateResult)
|
||||
assert.Equal(t, "Updated Obligation", updateResult.Obligation.Name)
|
||||
|
||||
// List
|
||||
var listResult struct {
|
||||
Obligations []struct {
|
||||
ID string `json:"id"`
|
||||
} `json:"obligations"`
|
||||
}
|
||||
mc.CallToolInto("listObligations", map[string]any{
|
||||
"organizationId": orgID,
|
||||
}, &listResult)
|
||||
assert.NotEmpty(t, listResult.Obligations)
|
||||
|
||||
// Delete
|
||||
var deleteResult struct {
|
||||
DeletedObligationID string `json:"deletedObligationId"`
|
||||
}
|
||||
mc.CallToolInto("deleteObligation", map[string]any{
|
||||
"id": addResult.Obligation.ID,
|
||||
}, &deleteResult)
|
||||
assert.Equal(t, addResult.Obligation.ID, deleteResult.DeletedObligationID)
|
||||
}
|
||||
52
e2e/mcp/organization_context_test.go
Normal file
52
e2e/mcp/organization_context_test.go
Normal file
@@ -0,0 +1,52 @@
|
||||
// Copyright (c) 2025-2026 Probo Inc <hello@getprobo.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/testutil"
|
||||
)
|
||||
|
||||
func TestMCP_OrganizationContext(t *testing.T) {
|
||||
t.Parallel()
|
||||
owner := testutil.NewClient(t, testutil.RoleOwner)
|
||||
mc := testutil.NewMCPClient(t, owner)
|
||||
orgID := owner.GetOrganizationID().String()
|
||||
|
||||
// Get
|
||||
var getResult struct {
|
||||
OrganizationContext struct {
|
||||
ID string `json:"id"`
|
||||
} `json:"organizationContext"`
|
||||
}
|
||||
mc.CallToolInto("getOrganizationContext", map[string]any{
|
||||
"organizationId": orgID,
|
||||
}, &getResult)
|
||||
assert.NotEmpty(t, getResult.OrganizationContext.ID)
|
||||
|
||||
// Update
|
||||
var updateResult struct {
|
||||
OrganizationContext struct {
|
||||
ID string `json:"id"`
|
||||
} `json:"organizationContext"`
|
||||
}
|
||||
mc.CallToolInto("updateOrganizationContext", map[string]any{
|
||||
"id": getResult.OrganizationContext.ID,
|
||||
"companyLegalName": "Test Company LLC",
|
||||
}, &updateResult)
|
||||
assert.Equal(t, getResult.OrganizationContext.ID, updateResult.OrganizationContext.ID)
|
||||
}
|
||||
38
e2e/mcp/organization_test.go
Normal file
38
e2e/mcp/organization_test.go
Normal file
@@ -0,0 +1,38 @@
|
||||
// Copyright (c) 2025-2026 Probo Inc <hello@getprobo.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/testutil"
|
||||
)
|
||||
|
||||
func TestMCP_ListOrganizations(t *testing.T) {
|
||||
t.Parallel()
|
||||
owner := testutil.NewClient(t, testutil.RoleOwner)
|
||||
mc := testutil.NewMCPClient(t, owner)
|
||||
|
||||
var result struct {
|
||||
Organizations []struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
} `json:"organizations"`
|
||||
}
|
||||
mc.CallToolInto("listOrganizations", map[string]any{}, &result)
|
||||
|
||||
assert.NotEmpty(t, result.Organizations)
|
||||
}
|
||||
89
e2e/mcp/processing_activity_test.go
Normal file
89
e2e/mcp/processing_activity_test.go
Normal file
@@ -0,0 +1,89 @@
|
||||
// Copyright (c) 2025-2026 Probo Inc <hello@getprobo.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"
|
||||
"github.com/stretchr/testify/require"
|
||||
"go.probo.inc/probo/e2e/internal/factory"
|
||||
"go.probo.inc/probo/e2e/internal/testutil"
|
||||
)
|
||||
|
||||
func TestMCP_ProcessingActivity_CRUD(t *testing.T) {
|
||||
t.Parallel()
|
||||
owner := testutil.NewClient(t, testutil.RoleOwner)
|
||||
mc := testutil.NewMCPClient(t, owner)
|
||||
orgID := owner.GetOrganizationID().String()
|
||||
|
||||
// Create
|
||||
var addResult struct {
|
||||
ProcessingActivity struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
} `json:"processingActivity"`
|
||||
}
|
||||
mc.CallToolInto("addProcessingActivity", map[string]any{
|
||||
"organizationId": orgID,
|
||||
"name": factory.SafeName("PA"),
|
||||
"lawfulBasis": "CONSENT",
|
||||
}, &addResult)
|
||||
require.NotEmpty(t, addResult.ProcessingActivity.ID)
|
||||
|
||||
// Get
|
||||
var getResult struct {
|
||||
ProcessingActivity struct {
|
||||
ID string `json:"id"`
|
||||
} `json:"processingActivity"`
|
||||
}
|
||||
mc.CallToolInto("getProcessingActivity", map[string]any{
|
||||
"id": addResult.ProcessingActivity.ID,
|
||||
}, &getResult)
|
||||
assert.Equal(t, addResult.ProcessingActivity.ID, getResult.ProcessingActivity.ID)
|
||||
|
||||
// Update
|
||||
var updateResult struct {
|
||||
ProcessingActivity struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
} `json:"processingActivity"`
|
||||
}
|
||||
mc.CallToolInto("updateProcessingActivity", map[string]any{
|
||||
"id": addResult.ProcessingActivity.ID,
|
||||
"name": "Updated PA",
|
||||
}, &updateResult)
|
||||
assert.Equal(t, "Updated PA", updateResult.ProcessingActivity.Name)
|
||||
|
||||
// List
|
||||
var listResult struct {
|
||||
ProcessingActivities []struct {
|
||||
ID string `json:"id"`
|
||||
} `json:"processingActivities"`
|
||||
}
|
||||
mc.CallToolInto("listProcessingActivities", map[string]any{
|
||||
"organizationId": orgID,
|
||||
}, &listResult)
|
||||
assert.NotEmpty(t, listResult.ProcessingActivities)
|
||||
|
||||
// Delete
|
||||
var deleteResult struct {
|
||||
DeletedProcessingActivityID string `json:"deletedProcessingActivityId"`
|
||||
}
|
||||
mc.CallToolInto("deleteProcessingActivity", map[string]any{
|
||||
"id": addResult.ProcessingActivity.ID,
|
||||
}, &deleteResult)
|
||||
assert.Equal(t, addResult.ProcessingActivity.ID, deleteResult.DeletedProcessingActivityID)
|
||||
}
|
||||
204
e2e/mcp/rights_request_test.go
Normal file
204
e2e/mcp/rights_request_test.go
Normal file
@@ -0,0 +1,204 @@
|
||||
// Copyright (c) 2025-2026 Probo Inc <hello@getprobo.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"
|
||||
"github.com/stretchr/testify/require"
|
||||
"go.probo.inc/probo/e2e/internal/factory"
|
||||
"go.probo.inc/probo/e2e/internal/testutil"
|
||||
)
|
||||
|
||||
type rightsRequest struct {
|
||||
ID string `json:"id"`
|
||||
RequestType string `json:"requestType"`
|
||||
RequestState string `json:"requestState"`
|
||||
DataSubject string `json:"dataSubject"`
|
||||
Contact *string `json:"contact"`
|
||||
Details *string `json:"details"`
|
||||
}
|
||||
|
||||
func TestMCP_AddRightsRequest(t *testing.T) {
|
||||
t.Parallel()
|
||||
owner := testutil.NewClient(t, testutil.RoleOwner)
|
||||
mc := testutil.NewMCPClient(t, owner)
|
||||
orgID := owner.GetOrganizationID().String()
|
||||
|
||||
var result struct {
|
||||
RightsRequest rightsRequest `json:"rightsRequest"`
|
||||
}
|
||||
mc.CallToolInto("addRightsRequest", map[string]any{
|
||||
"organizationId": orgID,
|
||||
"requestType": "ACCESS",
|
||||
"requestState": "TODO",
|
||||
"dataSubject": "John Doe",
|
||||
"contact": "john@example.com",
|
||||
"details": "Request for data access",
|
||||
}, &result)
|
||||
|
||||
assert.NotEmpty(t, result.RightsRequest.ID)
|
||||
assert.Equal(t, "ACCESS", result.RightsRequest.RequestType)
|
||||
assert.Equal(t, "TODO", result.RightsRequest.RequestState)
|
||||
assert.Equal(t, "John Doe", result.RightsRequest.DataSubject)
|
||||
}
|
||||
|
||||
func TestMCP_GetRightsRequest(t *testing.T) {
|
||||
t.Parallel()
|
||||
owner := testutil.NewClient(t, testutil.RoleOwner)
|
||||
mc := testutil.NewMCPClient(t, owner)
|
||||
orgID := owner.GetOrganizationID().String()
|
||||
|
||||
// Create
|
||||
var addResult struct {
|
||||
RightsRequest rightsRequest `json:"rightsRequest"`
|
||||
}
|
||||
mc.CallToolInto("addRightsRequest", map[string]any{
|
||||
"organizationId": orgID,
|
||||
"requestType": "DELETION",
|
||||
"requestState": "TODO",
|
||||
"dataSubject": "Jane Doe",
|
||||
}, &addResult)
|
||||
require.NotEmpty(t, addResult.RightsRequest.ID)
|
||||
|
||||
// Get
|
||||
var getResult struct {
|
||||
RightsRequest rightsRequest `json:"rightsRequest"`
|
||||
}
|
||||
mc.CallToolInto("getRightsRequest", map[string]any{
|
||||
"id": addResult.RightsRequest.ID,
|
||||
}, &getResult)
|
||||
|
||||
assert.Equal(t, addResult.RightsRequest.ID, getResult.RightsRequest.ID)
|
||||
assert.Equal(t, "DELETION", getResult.RightsRequest.RequestType)
|
||||
assert.Equal(t, "Jane Doe", getResult.RightsRequest.DataSubject)
|
||||
}
|
||||
|
||||
func TestMCP_UpdateRightsRequest(t *testing.T) {
|
||||
t.Parallel()
|
||||
owner := testutil.NewClient(t, testutil.RoleOwner)
|
||||
mc := testutil.NewMCPClient(t, owner)
|
||||
orgID := owner.GetOrganizationID().String()
|
||||
|
||||
// Create
|
||||
var addResult struct {
|
||||
RightsRequest rightsRequest `json:"rightsRequest"`
|
||||
}
|
||||
mc.CallToolInto("addRightsRequest", map[string]any{
|
||||
"organizationId": orgID,
|
||||
"requestType": "ACCESS",
|
||||
"requestState": "TODO",
|
||||
"dataSubject": "Test Subject",
|
||||
}, &addResult)
|
||||
require.NotEmpty(t, addResult.RightsRequest.ID)
|
||||
|
||||
// Update
|
||||
var updateResult struct {
|
||||
RightsRequest rightsRequest `json:"rightsRequest"`
|
||||
}
|
||||
mc.CallToolInto("updateRightsRequest", map[string]any{
|
||||
"id": addResult.RightsRequest.ID,
|
||||
"requestState": "IN_PROGRESS",
|
||||
"dataSubject": "Updated Subject",
|
||||
}, &updateResult)
|
||||
|
||||
assert.Equal(t, addResult.RightsRequest.ID, updateResult.RightsRequest.ID)
|
||||
assert.Equal(t, "IN_PROGRESS", updateResult.RightsRequest.RequestState)
|
||||
assert.Equal(t, "Updated Subject", updateResult.RightsRequest.DataSubject)
|
||||
}
|
||||
|
||||
func TestMCP_DeleteRightsRequest(t *testing.T) {
|
||||
t.Parallel()
|
||||
owner := testutil.NewClient(t, testutil.RoleOwner)
|
||||
mc := testutil.NewMCPClient(t, owner)
|
||||
orgID := owner.GetOrganizationID().String()
|
||||
|
||||
// Create
|
||||
var addResult struct {
|
||||
RightsRequest rightsRequest `json:"rightsRequest"`
|
||||
}
|
||||
mc.CallToolInto("addRightsRequest", map[string]any{
|
||||
"organizationId": orgID,
|
||||
"requestType": "PORTABILITY",
|
||||
"requestState": "TODO",
|
||||
"dataSubject": "Delete Subject",
|
||||
}, &addResult)
|
||||
require.NotEmpty(t, addResult.RightsRequest.ID)
|
||||
|
||||
// Delete
|
||||
var deleteResult struct {
|
||||
DeletedRightsRequestID string `json:"deletedRightsRequestId"`
|
||||
}
|
||||
mc.CallToolInto("deleteRightsRequest", map[string]any{
|
||||
"id": addResult.RightsRequest.ID,
|
||||
}, &deleteResult)
|
||||
|
||||
assert.Equal(t, addResult.RightsRequest.ID, deleteResult.DeletedRightsRequestID)
|
||||
}
|
||||
|
||||
func TestMCP_ListRightsRequests(t *testing.T) {
|
||||
t.Parallel()
|
||||
owner := testutil.NewClient(t, testutil.RoleOwner)
|
||||
mc := testutil.NewMCPClient(t, owner)
|
||||
orgID := owner.GetOrganizationID().String()
|
||||
|
||||
// Create multiple rights requests
|
||||
for _, reqType := range []string{"ACCESS", "DELETION", "PORTABILITY"} {
|
||||
var result struct {
|
||||
RightsRequest rightsRequest `json:"rightsRequest"`
|
||||
}
|
||||
mc.CallToolInto("addRightsRequest", map[string]any{
|
||||
"organizationId": orgID,
|
||||
"requestType": reqType,
|
||||
"requestState": "TODO",
|
||||
"dataSubject": factory.SafeName("Subject"),
|
||||
}, &result)
|
||||
require.NotEmpty(t, result.RightsRequest.ID)
|
||||
}
|
||||
|
||||
// List
|
||||
var listResult struct {
|
||||
RightsRequests []rightsRequest `json:"rightsRequests"`
|
||||
}
|
||||
mc.CallToolInto("listRightsRequests", map[string]any{
|
||||
"organizationId": orgID,
|
||||
}, &listResult)
|
||||
|
||||
assert.GreaterOrEqual(t, len(listResult.RightsRequests), 3)
|
||||
}
|
||||
|
||||
func TestMCP_RightsRequest_Types(t *testing.T) {
|
||||
t.Parallel()
|
||||
owner := testutil.NewClient(t, testutil.RoleOwner)
|
||||
mc := testutil.NewMCPClient(t, owner)
|
||||
orgID := owner.GetOrganizationID().String()
|
||||
|
||||
for _, reqType := range []string{"ACCESS", "DELETION", "PORTABILITY"} {
|
||||
t.Run(reqType, func(t *testing.T) {
|
||||
var result struct {
|
||||
RightsRequest rightsRequest `json:"rightsRequest"`
|
||||
}
|
||||
mc.CallToolInto("addRightsRequest", map[string]any{
|
||||
"organizationId": orgID,
|
||||
"requestType": reqType,
|
||||
"requestState": "TODO",
|
||||
"dataSubject": factory.SafeName("Subject"),
|
||||
}, &result)
|
||||
|
||||
assert.Equal(t, reqType, result.RightsRequest.RequestType)
|
||||
})
|
||||
}
|
||||
}
|
||||
89
e2e/mcp/risk_test.go
Normal file
89
e2e/mcp/risk_test.go
Normal file
@@ -0,0 +1,89 @@
|
||||
// Copyright (c) 2025-2026 Probo Inc <hello@getprobo.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"
|
||||
"github.com/stretchr/testify/require"
|
||||
"go.probo.inc/probo/e2e/internal/factory"
|
||||
"go.probo.inc/probo/e2e/internal/testutil"
|
||||
)
|
||||
|
||||
func TestMCP_Risk_CRUD(t *testing.T) {
|
||||
t.Parallel()
|
||||
owner := testutil.NewClient(t, testutil.RoleOwner)
|
||||
mc := testutil.NewMCPClient(t, owner)
|
||||
orgID := owner.GetOrganizationID().String()
|
||||
|
||||
// Create
|
||||
var addResult struct {
|
||||
Risk struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
} `json:"risk"`
|
||||
}
|
||||
mc.CallToolInto("addRisk", map[string]any{
|
||||
"organizationId": orgID,
|
||||
"name": factory.SafeName("Risk"),
|
||||
}, &addResult)
|
||||
require.NotEmpty(t, addResult.Risk.ID)
|
||||
|
||||
// Get
|
||||
var getResult struct {
|
||||
Risk struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
} `json:"risk"`
|
||||
}
|
||||
mc.CallToolInto("getRisk", map[string]any{
|
||||
"id": addResult.Risk.ID,
|
||||
}, &getResult)
|
||||
assert.Equal(t, addResult.Risk.ID, getResult.Risk.ID)
|
||||
|
||||
// Update
|
||||
var updateResult struct {
|
||||
Risk struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
} `json:"risk"`
|
||||
}
|
||||
mc.CallToolInto("updateRisk", map[string]any{
|
||||
"id": addResult.Risk.ID,
|
||||
"name": "Updated Risk",
|
||||
}, &updateResult)
|
||||
assert.Equal(t, "Updated Risk", updateResult.Risk.Name)
|
||||
|
||||
// List
|
||||
var listResult struct {
|
||||
Risks []struct {
|
||||
ID string `json:"id"`
|
||||
} `json:"risks"`
|
||||
}
|
||||
mc.CallToolInto("listRisks", map[string]any{
|
||||
"organizationId": orgID,
|
||||
}, &listResult)
|
||||
assert.NotEmpty(t, listResult.Risks)
|
||||
|
||||
// Delete
|
||||
var deleteResult struct {
|
||||
DeletedRiskID string `json:"deletedRiskId"`
|
||||
}
|
||||
mc.CallToolInto("deleteRisk", map[string]any{
|
||||
"id": addResult.Risk.ID,
|
||||
}, &deleteResult)
|
||||
assert.Equal(t, addResult.Risk.ID, deleteResult.DeletedRiskID)
|
||||
}
|
||||
69
e2e/mcp/snapshot_test.go
Normal file
69
e2e/mcp/snapshot_test.go
Normal file
@@ -0,0 +1,69 @@
|
||||
// Copyright (c) 2025-2026 Probo Inc <hello@getprobo.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"
|
||||
"github.com/stretchr/testify/require"
|
||||
"go.probo.inc/probo/e2e/internal/factory"
|
||||
"go.probo.inc/probo/e2e/internal/testutil"
|
||||
)
|
||||
|
||||
func TestMCP_Snapshot(t *testing.T) {
|
||||
t.Parallel()
|
||||
owner := testutil.NewClient(t, testutil.RoleOwner)
|
||||
mc := testutil.NewMCPClient(t, owner)
|
||||
orgID := owner.GetOrganizationID().String()
|
||||
|
||||
// Create a vendor so the snapshot has data
|
||||
factory.CreateVendor(owner)
|
||||
|
||||
// Take snapshot
|
||||
var takeResult struct {
|
||||
Snapshot struct {
|
||||
ID string `json:"id"`
|
||||
} `json:"snapshot"`
|
||||
}
|
||||
mc.CallToolInto("takeSnapshot", map[string]any{
|
||||
"organizationId": orgID,
|
||||
"name": factory.SafeName("Snapshot"),
|
||||
"snapshotsType": "VENDORS",
|
||||
}, &takeResult)
|
||||
require.NotEmpty(t, takeResult.Snapshot.ID)
|
||||
|
||||
// Get
|
||||
var getResult struct {
|
||||
Snapshot struct {
|
||||
ID string `json:"id"`
|
||||
} `json:"snapshot"`
|
||||
}
|
||||
mc.CallToolInto("getSnapshot", map[string]any{
|
||||
"id": takeResult.Snapshot.ID,
|
||||
}, &getResult)
|
||||
assert.Equal(t, takeResult.Snapshot.ID, getResult.Snapshot.ID)
|
||||
|
||||
// List
|
||||
var listResult struct {
|
||||
Snapshots []struct {
|
||||
ID string `json:"id"`
|
||||
} `json:"snapshots"`
|
||||
}
|
||||
mc.CallToolInto("listSnapshots", map[string]any{
|
||||
"organizationId": orgID,
|
||||
}, &listResult)
|
||||
assert.NotEmpty(t, listResult.Snapshots)
|
||||
}
|
||||
88
e2e/mcp/task_test.go
Normal file
88
e2e/mcp/task_test.go
Normal file
@@ -0,0 +1,88 @@
|
||||
// Copyright (c) 2025-2026 Probo Inc <hello@getprobo.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"
|
||||
"github.com/stretchr/testify/require"
|
||||
"go.probo.inc/probo/e2e/internal/factory"
|
||||
"go.probo.inc/probo/e2e/internal/testutil"
|
||||
)
|
||||
|
||||
func TestMCP_Task_CRUD(t *testing.T) {
|
||||
t.Parallel()
|
||||
owner := testutil.NewClient(t, testutil.RoleOwner)
|
||||
mc := testutil.NewMCPClient(t, owner)
|
||||
measureID := factory.CreateMeasure(owner)
|
||||
|
||||
// Create
|
||||
var addResult struct {
|
||||
Task struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
} `json:"task"`
|
||||
}
|
||||
mc.CallToolInto("addTask", map[string]any{
|
||||
"measureId": measureID,
|
||||
"name": factory.SafeName("Task"),
|
||||
}, &addResult)
|
||||
require.NotEmpty(t, addResult.Task.ID)
|
||||
|
||||
// Get
|
||||
var getResult struct {
|
||||
Task struct {
|
||||
ID string `json:"id"`
|
||||
} `json:"task"`
|
||||
}
|
||||
mc.CallToolInto("getTask", map[string]any{
|
||||
"id": addResult.Task.ID,
|
||||
}, &getResult)
|
||||
assert.Equal(t, addResult.Task.ID, getResult.Task.ID)
|
||||
|
||||
// Update
|
||||
var updateResult struct {
|
||||
Task struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
} `json:"task"`
|
||||
}
|
||||
mc.CallToolInto("updateTask", map[string]any{
|
||||
"id": addResult.Task.ID,
|
||||
"name": "Updated Task",
|
||||
}, &updateResult)
|
||||
assert.Equal(t, "Updated Task", updateResult.Task.Name)
|
||||
|
||||
// List
|
||||
var listResult struct {
|
||||
Tasks []struct {
|
||||
ID string `json:"id"`
|
||||
} `json:"tasks"`
|
||||
}
|
||||
mc.CallToolInto("listTasks", map[string]any{
|
||||
"measureId": measureID,
|
||||
}, &listResult)
|
||||
assert.NotEmpty(t, listResult.Tasks)
|
||||
|
||||
// Delete
|
||||
var deleteResult struct {
|
||||
DeletedTaskID string `json:"deletedTaskId"`
|
||||
}
|
||||
mc.CallToolInto("deleteTask", map[string]any{
|
||||
"id": addResult.Task.ID,
|
||||
}, &deleteResult)
|
||||
assert.Equal(t, addResult.Task.ID, deleteResult.DeletedTaskID)
|
||||
}
|
||||
410
e2e/mcp/trust_center_test.go
Normal file
410
e2e/mcp/trust_center_test.go
Normal file
@@ -0,0 +1,410 @@
|
||||
// Copyright (c) 2025-2026 Probo Inc <hello@getprobo.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"
|
||||
"github.com/stretchr/testify/require"
|
||||
"go.probo.inc/probo/e2e/internal/factory"
|
||||
"go.probo.inc/probo/e2e/internal/testutil"
|
||||
)
|
||||
|
||||
type trustCenter struct {
|
||||
ID string `json:"id"`
|
||||
CompanyName string `json:"companyName"`
|
||||
PageTitle string `json:"pageTitle"`
|
||||
TrustCenterVisible bool `json:"trustCenterVisible"`
|
||||
}
|
||||
|
||||
type trustCenterReference struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
URL string `json:"url"`
|
||||
Order int `json:"order"`
|
||||
}
|
||||
|
||||
type complianceExternalURL struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
URL string `json:"url"`
|
||||
}
|
||||
|
||||
func TestMCP_GetTrustCenter(t *testing.T) {
|
||||
t.Parallel()
|
||||
owner := testutil.NewClient(t, testutil.RoleOwner)
|
||||
mc := testutil.NewMCPClient(t, owner)
|
||||
orgID := owner.GetOrganizationID().String()
|
||||
|
||||
var result struct {
|
||||
TrustCenter trustCenter `json:"trustCenter"`
|
||||
}
|
||||
mc.CallToolInto("getTrustCenter", map[string]any{
|
||||
"organizationId": orgID,
|
||||
}, &result)
|
||||
|
||||
assert.NotEmpty(t, result.TrustCenter.ID)
|
||||
}
|
||||
|
||||
func TestMCP_UpdateTrustCenter(t *testing.T) {
|
||||
t.Parallel()
|
||||
owner := testutil.NewClient(t, testutil.RoleOwner)
|
||||
mc := testutil.NewMCPClient(t, owner)
|
||||
orgID := owner.GetOrganizationID().String()
|
||||
|
||||
// Get trust center ID
|
||||
var getResult struct {
|
||||
TrustCenter trustCenter `json:"trustCenter"`
|
||||
}
|
||||
mc.CallToolInto("getTrustCenter", map[string]any{
|
||||
"organizationId": orgID,
|
||||
}, &getResult)
|
||||
require.NotEmpty(t, getResult.TrustCenter.ID)
|
||||
|
||||
// Update
|
||||
var updateResult struct {
|
||||
TrustCenter trustCenter `json:"trustCenter"`
|
||||
}
|
||||
mc.CallToolInto("updateTrustCenter", map[string]any{
|
||||
"id": getResult.TrustCenter.ID,
|
||||
"companyName": "Updated Company",
|
||||
"pageTitle": "Updated Trust Center",
|
||||
}, &updateResult)
|
||||
|
||||
assert.Equal(t, getResult.TrustCenter.ID, updateResult.TrustCenter.ID)
|
||||
assert.Equal(t, "Updated Company", updateResult.TrustCenter.CompanyName)
|
||||
assert.Equal(t, "Updated Trust Center", updateResult.TrustCenter.PageTitle)
|
||||
}
|
||||
|
||||
func TestMCP_AddTrustCenterReference(t *testing.T) {
|
||||
t.Parallel()
|
||||
owner := testutil.NewClient(t, testutil.RoleOwner)
|
||||
mc := testutil.NewMCPClient(t, owner)
|
||||
orgID := owner.GetOrganizationID().String()
|
||||
|
||||
// Get trust center ID
|
||||
var getResult struct {
|
||||
TrustCenter trustCenter `json:"trustCenter"`
|
||||
}
|
||||
mc.CallToolInto("getTrustCenter", map[string]any{
|
||||
"organizationId": orgID,
|
||||
}, &getResult)
|
||||
tcID := getResult.TrustCenter.ID
|
||||
|
||||
var result struct {
|
||||
TrustCenterReference trustCenterReference `json:"trustCenterReference"`
|
||||
}
|
||||
mc.CallToolInto("addTrustCenterReference", map[string]any{
|
||||
"trustCenterId": tcID,
|
||||
"name": "SOC 2 Report",
|
||||
"url": "https://example.com/soc2",
|
||||
}, &result)
|
||||
|
||||
assert.NotEmpty(t, result.TrustCenterReference.ID)
|
||||
assert.Equal(t, "SOC 2 Report", result.TrustCenterReference.Name)
|
||||
}
|
||||
|
||||
func TestMCP_UpdateTrustCenterReference(t *testing.T) {
|
||||
t.Parallel()
|
||||
owner := testutil.NewClient(t, testutil.RoleOwner)
|
||||
mc := testutil.NewMCPClient(t, owner)
|
||||
orgID := owner.GetOrganizationID().String()
|
||||
|
||||
// Get trust center ID
|
||||
var getResult struct {
|
||||
TrustCenter trustCenter `json:"trustCenter"`
|
||||
}
|
||||
mc.CallToolInto("getTrustCenter", map[string]any{
|
||||
"organizationId": orgID,
|
||||
}, &getResult)
|
||||
tcID := getResult.TrustCenter.ID
|
||||
|
||||
// Create reference
|
||||
var addResult struct {
|
||||
TrustCenterReference trustCenterReference `json:"trustCenterReference"`
|
||||
}
|
||||
mc.CallToolInto("addTrustCenterReference", map[string]any{
|
||||
"trustCenterId": tcID,
|
||||
"name": "Original Reference",
|
||||
"url": "https://example.com/original",
|
||||
}, &addResult)
|
||||
require.NotEmpty(t, addResult.TrustCenterReference.ID)
|
||||
|
||||
// Update reference
|
||||
var updateResult struct {
|
||||
TrustCenterReference trustCenterReference `json:"trustCenterReference"`
|
||||
}
|
||||
mc.CallToolInto("updateTrustCenterReference", map[string]any{
|
||||
"id": addResult.TrustCenterReference.ID,
|
||||
"name": "Updated Reference",
|
||||
"url": "https://example.com/updated",
|
||||
}, &updateResult)
|
||||
|
||||
assert.Equal(t, addResult.TrustCenterReference.ID, updateResult.TrustCenterReference.ID)
|
||||
assert.Equal(t, "Updated Reference", updateResult.TrustCenterReference.Name)
|
||||
}
|
||||
|
||||
func TestMCP_DeleteTrustCenterReference(t *testing.T) {
|
||||
t.Parallel()
|
||||
owner := testutil.NewClient(t, testutil.RoleOwner)
|
||||
mc := testutil.NewMCPClient(t, owner)
|
||||
orgID := owner.GetOrganizationID().String()
|
||||
|
||||
// Get trust center ID
|
||||
var getResult struct {
|
||||
TrustCenter trustCenter `json:"trustCenter"`
|
||||
}
|
||||
mc.CallToolInto("getTrustCenter", map[string]any{
|
||||
"organizationId": orgID,
|
||||
}, &getResult)
|
||||
tcID := getResult.TrustCenter.ID
|
||||
|
||||
// Create reference
|
||||
var addResult struct {
|
||||
TrustCenterReference trustCenterReference `json:"trustCenterReference"`
|
||||
}
|
||||
mc.CallToolInto("addTrustCenterReference", map[string]any{
|
||||
"trustCenterId": tcID,
|
||||
"name": "Reference to delete",
|
||||
"url": "https://example.com/delete",
|
||||
}, &addResult)
|
||||
require.NotEmpty(t, addResult.TrustCenterReference.ID)
|
||||
|
||||
// Delete
|
||||
var deleteResult struct {
|
||||
DeletedTrustCenterReferenceID string `json:"deletedTrustCenterReferenceId"`
|
||||
}
|
||||
mc.CallToolInto("deleteTrustCenterReference", map[string]any{
|
||||
"id": addResult.TrustCenterReference.ID,
|
||||
}, &deleteResult)
|
||||
|
||||
assert.Equal(t, addResult.TrustCenterReference.ID, deleteResult.DeletedTrustCenterReferenceID)
|
||||
}
|
||||
|
||||
func TestMCP_ListTrustCenterReferences(t *testing.T) {
|
||||
t.Parallel()
|
||||
owner := testutil.NewClient(t, testutil.RoleOwner)
|
||||
mc := testutil.NewMCPClient(t, owner)
|
||||
orgID := owner.GetOrganizationID().String()
|
||||
|
||||
// Get trust center ID
|
||||
var getResult struct {
|
||||
TrustCenter trustCenter `json:"trustCenter"`
|
||||
}
|
||||
mc.CallToolInto("getTrustCenter", map[string]any{
|
||||
"organizationId": orgID,
|
||||
}, &getResult)
|
||||
tcID := getResult.TrustCenter.ID
|
||||
|
||||
// Create references
|
||||
for i := range 2 {
|
||||
var result struct {
|
||||
TrustCenterReference trustCenterReference `json:"trustCenterReference"`
|
||||
}
|
||||
mc.CallToolInto("addTrustCenterReference", map[string]any{
|
||||
"trustCenterId": tcID,
|
||||
"name": factory.SafeName("Ref"),
|
||||
"url": "https://example.com/" + factory.SafeName("path"),
|
||||
}, &result)
|
||||
require.NotEmpty(t, result.TrustCenterReference.ID)
|
||||
_ = i
|
||||
}
|
||||
|
||||
// List
|
||||
var listResult struct {
|
||||
TrustCenterReferences []trustCenterReference `json:"trustCenterReferences"`
|
||||
}
|
||||
mc.CallToolInto("listTrustCenterReferences", map[string]any{
|
||||
"trustCenterId": tcID,
|
||||
}, &listResult)
|
||||
|
||||
assert.GreaterOrEqual(t, len(listResult.TrustCenterReferences), 2)
|
||||
}
|
||||
|
||||
func TestMCP_ListTrustCenterFiles(t *testing.T) {
|
||||
t.Parallel()
|
||||
owner := testutil.NewClient(t, testutil.RoleOwner)
|
||||
mc := testutil.NewMCPClient(t, owner)
|
||||
orgID := owner.GetOrganizationID().String()
|
||||
|
||||
// Get trust center ID
|
||||
var getResult struct {
|
||||
TrustCenter trustCenter `json:"trustCenter"`
|
||||
}
|
||||
mc.CallToolInto("getTrustCenter", map[string]any{
|
||||
"organizationId": orgID,
|
||||
}, &getResult)
|
||||
tcID := getResult.TrustCenter.ID
|
||||
|
||||
// List files (may be empty, just verify the tool works)
|
||||
var listResult struct {
|
||||
TrustCenterFiles []struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
} `json:"trustCenterFiles"`
|
||||
}
|
||||
mc.CallToolInto("listTrustCenterFiles", map[string]any{
|
||||
"trustCenterId": tcID,
|
||||
}, &listResult)
|
||||
|
||||
// Just assert the call succeeded — files require multipart upload
|
||||
assert.NotNil(t, listResult.TrustCenterFiles)
|
||||
}
|
||||
|
||||
func TestMCP_AddComplianceExternalURL(t *testing.T) {
|
||||
t.Parallel()
|
||||
owner := testutil.NewClient(t, testutil.RoleOwner)
|
||||
mc := testutil.NewMCPClient(t, owner)
|
||||
orgID := owner.GetOrganizationID().String()
|
||||
|
||||
// Get trust center ID
|
||||
var getResult struct {
|
||||
TrustCenter trustCenter `json:"trustCenter"`
|
||||
}
|
||||
mc.CallToolInto("getTrustCenter", map[string]any{
|
||||
"organizationId": orgID,
|
||||
}, &getResult)
|
||||
tcID := getResult.TrustCenter.ID
|
||||
|
||||
var result struct {
|
||||
ComplianceExternalURL complianceExternalURL `json:"complianceExternalUrl"`
|
||||
}
|
||||
mc.CallToolInto("addComplianceExternalURL", map[string]any{
|
||||
"trustCenterId": tcID,
|
||||
"name": "ISO 27001 Certificate",
|
||||
"url": "https://example.com/iso27001",
|
||||
}, &result)
|
||||
|
||||
assert.NotEmpty(t, result.ComplianceExternalURL.ID)
|
||||
assert.Equal(t, "ISO 27001 Certificate", result.ComplianceExternalURL.Name)
|
||||
}
|
||||
|
||||
func TestMCP_UpdateComplianceExternalURL(t *testing.T) {
|
||||
t.Parallel()
|
||||
owner := testutil.NewClient(t, testutil.RoleOwner)
|
||||
mc := testutil.NewMCPClient(t, owner)
|
||||
orgID := owner.GetOrganizationID().String()
|
||||
|
||||
// Get trust center ID
|
||||
var getResult struct {
|
||||
TrustCenter trustCenter `json:"trustCenter"`
|
||||
}
|
||||
mc.CallToolInto("getTrustCenter", map[string]any{
|
||||
"organizationId": orgID,
|
||||
}, &getResult)
|
||||
tcID := getResult.TrustCenter.ID
|
||||
|
||||
// Create
|
||||
var addResult struct {
|
||||
ComplianceExternalURL complianceExternalURL `json:"complianceExternalUrl"`
|
||||
}
|
||||
mc.CallToolInto("addComplianceExternalURL", map[string]any{
|
||||
"trustCenterId": tcID,
|
||||
"name": "Original URL",
|
||||
"url": "https://example.com/original",
|
||||
}, &addResult)
|
||||
require.NotEmpty(t, addResult.ComplianceExternalURL.ID)
|
||||
|
||||
// Update
|
||||
var updateResult struct {
|
||||
ComplianceExternalURL complianceExternalURL `json:"complianceExternalUrl"`
|
||||
}
|
||||
mc.CallToolInto("updateComplianceExternalURL", map[string]any{
|
||||
"id": addResult.ComplianceExternalURL.ID,
|
||||
"name": "Updated URL",
|
||||
"url": "https://example.com/updated",
|
||||
}, &updateResult)
|
||||
|
||||
assert.Equal(t, addResult.ComplianceExternalURL.ID, updateResult.ComplianceExternalURL.ID)
|
||||
assert.Equal(t, "Updated URL", updateResult.ComplianceExternalURL.Name)
|
||||
}
|
||||
|
||||
func TestMCP_DeleteComplianceExternalURL(t *testing.T) {
|
||||
t.Parallel()
|
||||
owner := testutil.NewClient(t, testutil.RoleOwner)
|
||||
mc := testutil.NewMCPClient(t, owner)
|
||||
orgID := owner.GetOrganizationID().String()
|
||||
|
||||
// Get trust center ID
|
||||
var getResult struct {
|
||||
TrustCenter trustCenter `json:"trustCenter"`
|
||||
}
|
||||
mc.CallToolInto("getTrustCenter", map[string]any{
|
||||
"organizationId": orgID,
|
||||
}, &getResult)
|
||||
tcID := getResult.TrustCenter.ID
|
||||
|
||||
// Create
|
||||
var addResult struct {
|
||||
ComplianceExternalURL complianceExternalURL `json:"complianceExternalUrl"`
|
||||
}
|
||||
mc.CallToolInto("addComplianceExternalURL", map[string]any{
|
||||
"trustCenterId": tcID,
|
||||
"name": "URL to delete",
|
||||
"url": "https://example.com/delete",
|
||||
}, &addResult)
|
||||
require.NotEmpty(t, addResult.ComplianceExternalURL.ID)
|
||||
|
||||
// Delete
|
||||
var deleteResult struct {
|
||||
DeletedComplianceExternalURLID string `json:"deletedComplianceExternalUrlId"`
|
||||
}
|
||||
mc.CallToolInto("deleteComplianceExternalURL", map[string]any{
|
||||
"id": addResult.ComplianceExternalURL.ID,
|
||||
}, &deleteResult)
|
||||
|
||||
assert.Equal(t, addResult.ComplianceExternalURL.ID, deleteResult.DeletedComplianceExternalURLID)
|
||||
}
|
||||
|
||||
func TestMCP_ListComplianceExternalURLs(t *testing.T) {
|
||||
t.Parallel()
|
||||
owner := testutil.NewClient(t, testutil.RoleOwner)
|
||||
mc := testutil.NewMCPClient(t, owner)
|
||||
orgID := owner.GetOrganizationID().String()
|
||||
|
||||
// Get trust center ID
|
||||
var getResult struct {
|
||||
TrustCenter trustCenter `json:"trustCenter"`
|
||||
}
|
||||
mc.CallToolInto("getTrustCenter", map[string]any{
|
||||
"organizationId": orgID,
|
||||
}, &getResult)
|
||||
tcID := getResult.TrustCenter.ID
|
||||
|
||||
// Create URLs
|
||||
for i := range 2 {
|
||||
var result struct {
|
||||
ComplianceExternalURL complianceExternalURL `json:"complianceExternalUrl"`
|
||||
}
|
||||
mc.CallToolInto("addComplianceExternalURL", map[string]any{
|
||||
"trustCenterId": tcID,
|
||||
"name": factory.SafeName("URL"),
|
||||
"url": "https://example.com/" + factory.SafeName("path"),
|
||||
}, &result)
|
||||
require.NotEmpty(t, result.ComplianceExternalURL.ID)
|
||||
_ = i
|
||||
}
|
||||
|
||||
// List
|
||||
var listResult struct {
|
||||
ComplianceExternalURLs []complianceExternalURL `json:"complianceExternalUrls"`
|
||||
}
|
||||
mc.CallToolInto("listComplianceExternalURLs", map[string]any{
|
||||
"trustCenterId": tcID,
|
||||
}, &listResult)
|
||||
|
||||
assert.GreaterOrEqual(t, len(listResult.ComplianceExternalURLs), 2)
|
||||
}
|
||||
69
e2e/mcp/user_test.go
Normal file
69
e2e/mcp/user_test.go
Normal file
@@ -0,0 +1,69 @@
|
||||
// Copyright (c) 2025-2026 Probo Inc <hello@getprobo.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"
|
||||
"github.com/stretchr/testify/require"
|
||||
"go.probo.inc/probo/e2e/internal/factory"
|
||||
"go.probo.inc/probo/e2e/internal/testutil"
|
||||
)
|
||||
|
||||
func TestMCP_User_CRUD(t *testing.T) {
|
||||
t.Parallel()
|
||||
owner := testutil.NewClient(t, testutil.RoleOwner)
|
||||
mc := testutil.NewMCPClient(t, owner)
|
||||
orgID := owner.GetOrganizationID().String()
|
||||
|
||||
// Create
|
||||
var createResult struct {
|
||||
User struct {
|
||||
ID string `json:"id"`
|
||||
FullName string `json:"fullName"`
|
||||
} `json:"user"`
|
||||
}
|
||||
mc.CallToolInto("createUser", map[string]any{
|
||||
"organizationId": orgID,
|
||||
"fullName": "Test User",
|
||||
"emailAddress": factory.SafeEmail(),
|
||||
"role": "EMPLOYEE",
|
||||
"kind": "EMPLOYEE",
|
||||
}, &createResult)
|
||||
require.NotEmpty(t, createResult.User.ID)
|
||||
|
||||
// Get
|
||||
var getResult struct {
|
||||
User struct {
|
||||
ID string `json:"id"`
|
||||
} `json:"user"`
|
||||
}
|
||||
mc.CallToolInto("getUser", map[string]any{
|
||||
"id": createResult.User.ID,
|
||||
}, &getResult)
|
||||
assert.Equal(t, createResult.User.ID, getResult.User.ID)
|
||||
|
||||
// List
|
||||
var listResult struct {
|
||||
Users []struct {
|
||||
ID string `json:"id"`
|
||||
} `json:"users"`
|
||||
}
|
||||
mc.CallToolInto("listUsers", map[string]any{
|
||||
"organizationId": orgID,
|
||||
}, &listResult)
|
||||
assert.NotEmpty(t, listResult.Users)
|
||||
}
|
||||
142
e2e/mcp/vendor_contact_test.go
Normal file
142
e2e/mcp/vendor_contact_test.go
Normal file
@@ -0,0 +1,142 @@
|
||||
// Copyright (c) 2025-2026 Probo Inc <hello@getprobo.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"
|
||||
"github.com/stretchr/testify/require"
|
||||
"go.probo.inc/probo/e2e/internal/factory"
|
||||
"go.probo.inc/probo/e2e/internal/testutil"
|
||||
)
|
||||
|
||||
type vendorContact struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Email *string `json:"email"`
|
||||
Phone *string `json:"phone"`
|
||||
Role *string `json:"role"`
|
||||
}
|
||||
|
||||
func TestMCP_AddVendorContact(t *testing.T) {
|
||||
t.Parallel()
|
||||
owner := testutil.NewClient(t, testutil.RoleOwner)
|
||||
mc := testutil.NewMCPClient(t, owner)
|
||||
vendorID := factory.CreateVendor(owner)
|
||||
|
||||
var result struct {
|
||||
VendorContact vendorContact `json:"vendorContact"`
|
||||
}
|
||||
mc.CallToolInto("addVendorContact", map[string]any{
|
||||
"vendorId": vendorID,
|
||||
"name": "Alice Smith",
|
||||
"email": "alice@example.com",
|
||||
"phone": "+1-555-0100",
|
||||
"role": "Account Manager",
|
||||
}, &result)
|
||||
|
||||
assert.NotEmpty(t, result.VendorContact.ID)
|
||||
assert.Equal(t, "Alice Smith", result.VendorContact.Name)
|
||||
}
|
||||
|
||||
func TestMCP_UpdateVendorContact(t *testing.T) {
|
||||
t.Parallel()
|
||||
owner := testutil.NewClient(t, testutil.RoleOwner)
|
||||
mc := testutil.NewMCPClient(t, owner)
|
||||
vendorID := factory.CreateVendor(owner)
|
||||
|
||||
// Create
|
||||
var addResult struct {
|
||||
VendorContact vendorContact `json:"vendorContact"`
|
||||
}
|
||||
mc.CallToolInto("addVendorContact", map[string]any{
|
||||
"vendorId": vendorID,
|
||||
"name": "Bob Jones",
|
||||
"email": "bob@example.com",
|
||||
}, &addResult)
|
||||
require.NotEmpty(t, addResult.VendorContact.ID)
|
||||
|
||||
// Update
|
||||
var updateResult struct {
|
||||
VendorContact vendorContact `json:"vendorContact"`
|
||||
}
|
||||
mc.CallToolInto("updateVendorContact", map[string]any{
|
||||
"id": addResult.VendorContact.ID,
|
||||
"name": "Robert Jones",
|
||||
"role": "CTO",
|
||||
}, &updateResult)
|
||||
|
||||
assert.Equal(t, addResult.VendorContact.ID, updateResult.VendorContact.ID)
|
||||
assert.Equal(t, "Robert Jones", updateResult.VendorContact.Name)
|
||||
}
|
||||
|
||||
func TestMCP_DeleteVendorContact(t *testing.T) {
|
||||
t.Parallel()
|
||||
owner := testutil.NewClient(t, testutil.RoleOwner)
|
||||
mc := testutil.NewMCPClient(t, owner)
|
||||
vendorID := factory.CreateVendor(owner)
|
||||
|
||||
// Create
|
||||
var addResult struct {
|
||||
VendorContact vendorContact `json:"vendorContact"`
|
||||
}
|
||||
mc.CallToolInto("addVendorContact", map[string]any{
|
||||
"vendorId": vendorID,
|
||||
"name": "Contact to delete",
|
||||
}, &addResult)
|
||||
require.NotEmpty(t, addResult.VendorContact.ID)
|
||||
|
||||
// Delete
|
||||
var deleteResult struct {
|
||||
DeletedVendorContactID string `json:"deletedVendorContactId"`
|
||||
}
|
||||
mc.CallToolInto("deleteVendorContact", map[string]any{
|
||||
"id": addResult.VendorContact.ID,
|
||||
}, &deleteResult)
|
||||
|
||||
assert.Equal(t, addResult.VendorContact.ID, deleteResult.DeletedVendorContactID)
|
||||
}
|
||||
|
||||
func TestMCP_ListVendorContacts(t *testing.T) {
|
||||
t.Parallel()
|
||||
owner := testutil.NewClient(t, testutil.RoleOwner)
|
||||
mc := testutil.NewMCPClient(t, owner)
|
||||
vendorID := factory.CreateVendor(owner)
|
||||
|
||||
// Create contacts
|
||||
for i := range 3 {
|
||||
var result struct {
|
||||
VendorContact vendorContact `json:"vendorContact"`
|
||||
}
|
||||
mc.CallToolInto("addVendorContact", map[string]any{
|
||||
"vendorId": vendorID,
|
||||
"name": factory.SafeName("Contact"),
|
||||
"email": factory.SafeEmail(),
|
||||
}, &result)
|
||||
require.NotEmpty(t, result.VendorContact.ID)
|
||||
_ = i
|
||||
}
|
||||
|
||||
// List
|
||||
var listResult struct {
|
||||
VendorContacts []vendorContact `json:"vendorContacts"`
|
||||
}
|
||||
mc.CallToolInto("listVendorContacts", map[string]any{
|
||||
"vendorId": vendorID,
|
||||
}, &listResult)
|
||||
|
||||
assert.GreaterOrEqual(t, len(listResult.VendorContacts), 3)
|
||||
}
|
||||
135
e2e/mcp/vendor_service_test.go
Normal file
135
e2e/mcp/vendor_service_test.go
Normal file
@@ -0,0 +1,135 @@
|
||||
// Copyright (c) 2025-2026 Probo Inc <hello@getprobo.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"
|
||||
"github.com/stretchr/testify/require"
|
||||
"go.probo.inc/probo/e2e/internal/factory"
|
||||
"go.probo.inc/probo/e2e/internal/testutil"
|
||||
)
|
||||
|
||||
type vendorService struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Description *string `json:"description"`
|
||||
}
|
||||
|
||||
func TestMCP_AddVendorService(t *testing.T) {
|
||||
t.Parallel()
|
||||
owner := testutil.NewClient(t, testutil.RoleOwner)
|
||||
mc := testutil.NewMCPClient(t, owner)
|
||||
vendorID := factory.CreateVendor(owner)
|
||||
|
||||
var result struct {
|
||||
VendorService vendorService `json:"vendorService"`
|
||||
}
|
||||
mc.CallToolInto("addVendorService", map[string]any{
|
||||
"vendorId": vendorID,
|
||||
"name": "Cloud Storage",
|
||||
"description": "Object storage service",
|
||||
}, &result)
|
||||
|
||||
assert.NotEmpty(t, result.VendorService.ID)
|
||||
assert.Equal(t, "Cloud Storage", result.VendorService.Name)
|
||||
}
|
||||
|
||||
func TestMCP_UpdateVendorService(t *testing.T) {
|
||||
t.Parallel()
|
||||
owner := testutil.NewClient(t, testutil.RoleOwner)
|
||||
mc := testutil.NewMCPClient(t, owner)
|
||||
vendorID := factory.CreateVendor(owner)
|
||||
|
||||
// Create
|
||||
var addResult struct {
|
||||
VendorService vendorService `json:"vendorService"`
|
||||
}
|
||||
mc.CallToolInto("addVendorService", map[string]any{
|
||||
"vendorId": vendorID,
|
||||
"name": "Original Service",
|
||||
}, &addResult)
|
||||
require.NotEmpty(t, addResult.VendorService.ID)
|
||||
|
||||
// Update
|
||||
var updateResult struct {
|
||||
VendorService vendorService `json:"vendorService"`
|
||||
}
|
||||
mc.CallToolInto("updateVendorService", map[string]any{
|
||||
"id": addResult.VendorService.ID,
|
||||
"name": "Updated Service",
|
||||
}, &updateResult)
|
||||
|
||||
assert.Equal(t, addResult.VendorService.ID, updateResult.VendorService.ID)
|
||||
assert.Equal(t, "Updated Service", updateResult.VendorService.Name)
|
||||
}
|
||||
|
||||
func TestMCP_DeleteVendorService(t *testing.T) {
|
||||
t.Parallel()
|
||||
owner := testutil.NewClient(t, testutil.RoleOwner)
|
||||
mc := testutil.NewMCPClient(t, owner)
|
||||
vendorID := factory.CreateVendor(owner)
|
||||
|
||||
// Create
|
||||
var addResult struct {
|
||||
VendorService vendorService `json:"vendorService"`
|
||||
}
|
||||
mc.CallToolInto("addVendorService", map[string]any{
|
||||
"vendorId": vendorID,
|
||||
"name": "Service to delete",
|
||||
}, &addResult)
|
||||
require.NotEmpty(t, addResult.VendorService.ID)
|
||||
|
||||
// Delete
|
||||
var deleteResult struct {
|
||||
DeletedVendorServiceID string `json:"deletedVendorServiceId"`
|
||||
}
|
||||
mc.CallToolInto("deleteVendorService", map[string]any{
|
||||
"id": addResult.VendorService.ID,
|
||||
}, &deleteResult)
|
||||
|
||||
assert.Equal(t, addResult.VendorService.ID, deleteResult.DeletedVendorServiceID)
|
||||
}
|
||||
|
||||
func TestMCP_ListVendorServices(t *testing.T) {
|
||||
t.Parallel()
|
||||
owner := testutil.NewClient(t, testutil.RoleOwner)
|
||||
mc := testutil.NewMCPClient(t, owner)
|
||||
vendorID := factory.CreateVendor(owner)
|
||||
|
||||
// Create services
|
||||
for i := range 3 {
|
||||
var result struct {
|
||||
VendorService vendorService `json:"vendorService"`
|
||||
}
|
||||
mc.CallToolInto("addVendorService", map[string]any{
|
||||
"vendorId": vendorID,
|
||||
"name": factory.SafeName("Service"),
|
||||
}, &result)
|
||||
require.NotEmpty(t, result.VendorService.ID)
|
||||
_ = i
|
||||
}
|
||||
|
||||
// List
|
||||
var listResult struct {
|
||||
VendorServices []vendorService `json:"vendorServices"`
|
||||
}
|
||||
mc.CallToolInto("listVendorServices", map[string]any{
|
||||
"vendorId": vendorID,
|
||||
}, &listResult)
|
||||
|
||||
assert.GreaterOrEqual(t, len(listResult.VendorServices), 3)
|
||||
}
|
||||
79
e2e/mcp/vendor_test.go
Normal file
79
e2e/mcp/vendor_test.go
Normal file
@@ -0,0 +1,79 @@
|
||||
// Copyright (c) 2025-2026 Probo Inc <hello@getprobo.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"
|
||||
"github.com/stretchr/testify/require"
|
||||
"go.probo.inc/probo/e2e/internal/factory"
|
||||
"go.probo.inc/probo/e2e/internal/testutil"
|
||||
)
|
||||
|
||||
func TestMCP_Vendor_CRUD(t *testing.T) {
|
||||
t.Parallel()
|
||||
owner := testutil.NewClient(t, testutil.RoleOwner)
|
||||
mc := testutil.NewMCPClient(t, owner)
|
||||
orgID := owner.GetOrganizationID().String()
|
||||
|
||||
// Create
|
||||
var addResult struct {
|
||||
Vendor struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
} `json:"vendor"`
|
||||
}
|
||||
name := factory.SafeName("Vendor")
|
||||
mc.CallToolInto("addVendor", map[string]any{
|
||||
"organizationId": orgID,
|
||||
"name": name,
|
||||
}, &addResult)
|
||||
require.NotEmpty(t, addResult.Vendor.ID)
|
||||
assert.Equal(t, name, addResult.Vendor.Name)
|
||||
|
||||
// Update
|
||||
var updateResult struct {
|
||||
Vendor struct {
|
||||
ID string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
} `json:"vendor"`
|
||||
}
|
||||
mc.CallToolInto("updateVendor", map[string]any{
|
||||
"id": addResult.Vendor.ID,
|
||||
"name": "Updated Vendor",
|
||||
}, &updateResult)
|
||||
assert.Equal(t, "Updated Vendor", updateResult.Vendor.Name)
|
||||
|
||||
// List
|
||||
var listResult struct {
|
||||
Vendors []struct {
|
||||
ID string `json:"id"`
|
||||
} `json:"vendors"`
|
||||
}
|
||||
mc.CallToolInto("listVendors", map[string]any{
|
||||
"organizationId": orgID,
|
||||
}, &listResult)
|
||||
assert.NotEmpty(t, listResult.Vendors)
|
||||
|
||||
// Delete
|
||||
var deleteResult struct {
|
||||
DeletedVendorID string `json:"deletedVendorId"`
|
||||
}
|
||||
mc.CallToolInto("deleteVendor", map[string]any{
|
||||
"id": addResult.Vendor.ID,
|
||||
}, &deleteResult)
|
||||
assert.Equal(t, addResult.Vendor.ID, deleteResult.DeletedVendorID)
|
||||
}
|
||||
Reference in New Issue
Block a user