Files
gitea-mcp-extended/pkg/gitea/rest_test.go
Andrew Miller 60f05e5f1e
Some checks failed
release-nightly / publish-nightly (push) Failing after 44s
release / goreleaser (push) Failing after 37s
release / publish-packages (push) Has been skipped
feat: rename to gitea-mcp-extended and add package publishing workflows
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
2026-03-05 13:04:02 -05:00

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")
}
})
}