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,39 @@
|
||||
package mattermost
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestNewClient(t *testing.T) {
|
||||
client := NewClient("https://test.mattermost.com", "bot-token", "pat-token")
|
||||
assert.NotNil(t, client)
|
||||
assert.Equal(t, "https://test.mattermost.com", client.host)
|
||||
assert.Equal(t, "bot-token", client.botToken)
|
||||
assert.Equal(t, "pat-token", client.pat)
|
||||
}
|
||||
|
||||
func TestGetToken_ReadOperation(t *testing.T) {
|
||||
client := NewClient("https://test.mattermost.com", "bot-token", "pat-token")
|
||||
token := client.getToken(false)
|
||||
assert.Equal(t, "bot-token", token)
|
||||
}
|
||||
|
||||
func TestGetToken_WriteOperation(t *testing.T) {
|
||||
client := NewClient("https://test.mattermost.com", "bot-token", "pat-token")
|
||||
token := client.getToken(true)
|
||||
assert.Equal(t, "pat-token", token)
|
||||
}
|
||||
|
||||
func TestGetToken_FallbackToPAT(t *testing.T) {
|
||||
client := NewClient("https://test.mattermost.com", "", "pat-token")
|
||||
token := client.getToken(false)
|
||||
assert.Equal(t, "pat-token", token)
|
||||
}
|
||||
|
||||
func TestSetGlobalClient(t *testing.T) {
|
||||
client := NewClient("https://test.mattermost.com", "bot-token", "pat-token")
|
||||
SetGlobalClient(client)
|
||||
assert.Equal(t, client, GetGlobalClient())
|
||||
}
|
||||
Reference in New Issue
Block a user