feat: initial release with 48 Mattermost MCP tools
- 27 base tools: channels, messaging, users, reactions, files, DMs - Team management: invite/remove users, get stats, list members - Slash commands: execute /remind, /poll, etc. - Webhook management: incoming and outgoing webhooks - System tools: server config, logs, bulk status updates - Channel admin: create, invite, leave, delete channels - Read-only mode for safe exploration - Dual token support (bot + PAT) for enhanced security - Apache 2.0 licensed
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
package reaction
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/mattermost/mattermost-server/v6/model"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestSlimReaction(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
reaction *model.Reaction
|
||||
expected map[string]interface{}
|
||||
}{
|
||||
{
|
||||
name: "valid reaction",
|
||||
reaction: &model.Reaction{
|
||||
UserId: "user123",
|
||||
PostId: "post456",
|
||||
EmojiName: "thumbsup",
|
||||
CreateAt: 1234567890,
|
||||
},
|
||||
expected: map[string]interface{}{
|
||||
"user_id": "user123",
|
||||
"post_id": "post456",
|
||||
"emoji_name": "thumbsup",
|
||||
"create_at": int64(1234567890),
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "nil reaction",
|
||||
reaction: nil,
|
||||
expected: nil,
|
||||
},
|
||||
{
|
||||
name: "reaction with different emoji",
|
||||
reaction: &model.Reaction{
|
||||
UserId: "user789",
|
||||
PostId: "post012",
|
||||
EmojiName: "rocket",
|
||||
CreateAt: 9876543210,
|
||||
},
|
||||
expected: map[string]interface{}{
|
||||
"user_id": "user789",
|
||||
"post_id": "post012",
|
||||
"emoji_name": "rocket",
|
||||
"create_at": int64(9876543210),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
result := SlimReaction(tt.reaction)
|
||||
assert.Equal(t, tt.expected, result)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestToolConstants(t *testing.T) {
|
||||
assert.Equal(t, "mattermost_add_reaction", AddReactionToolName)
|
||||
assert.Equal(t, "mattermost_remove_reaction", RemoveReactionToolName)
|
||||
}
|
||||
|
||||
func TestToolRegistration(t *testing.T) {
|
||||
// Verify tools are registered
|
||||
tools := Tool.Tools()
|
||||
assert.Len(t, tools, 2)
|
||||
|
||||
toolNames := make([]string, len(tools))
|
||||
for i, t := range tools {
|
||||
toolNames[i] = t.Tool.Name
|
||||
}
|
||||
|
||||
assert.Contains(t, toolNames, AddReactionToolName)
|
||||
assert.Contains(t, toolNames, RemoveReactionToolName)
|
||||
}
|
||||
Reference in New Issue
Block a user