Rename the fork from gitea-mcp to gitea-mcp-extended to reflect the significantly expanded tool coverage (299 vs upstream's 93 tools). - Rename Go module path and all import references - Rename binary to gitea-mcp-extended in Makefile, Dockerfile, .gitignore - Point .goreleaser.yaml gitea_urls to git.lethalbits.com - Replace release-tag workflow with goreleaser + Generic Package Registry publishing - Replace release-nightly workflow with cross-platform build + nightly package publishing - Update CLAUDE.md project description and tool count
31 lines
804 B
Go
31 lines
804 B
Go
package gitea
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
mcpContext "git.lethalbits.com/lethalbits/gitea-mcp-extended/pkg/context"
|
|
"git.lethalbits.com/lethalbits/gitea-mcp-extended/pkg/flag"
|
|
)
|
|
|
|
func TestTokenFromContext(t *testing.T) {
|
|
orig := flag.Token
|
|
defer func() { flag.Token = orig }()
|
|
|
|
flag.Token = "flag-token"
|
|
|
|
t.Run("context token wins", func(t *testing.T) {
|
|
ctx := context.WithValue(context.Background(), mcpContext.TokenContextKey, "ctx-token")
|
|
if got := tokenFromContext(ctx); got != "ctx-token" {
|
|
t.Fatalf("tokenFromContext() = %q, want %q", got, "ctx-token")
|
|
}
|
|
})
|
|
|
|
t.Run("fallback to flag token", func(t *testing.T) {
|
|
ctx := context.Background()
|
|
if got := tokenFromContext(ctx); got != "flag-token" {
|
|
t.Fatalf("tokenFromContext() = %q, want %q", got, "flag-token")
|
|
}
|
|
})
|
|
}
|