MCPcopy Create free account
hub / github.com/github/gh-aw / TestGetEffectiveGitHubToken

Function TestGetEffectiveGitHubToken

pkg/workflow/github_token_test.go:9–35  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

7)
8
9func TestGetEffectiveGitHubToken(t *testing.T) {
10 tests := []struct {
11 name string
12 customToken string
13 expected string
14 }{
15 {
16 name: "custom token has highest precedence",
17 customToken: "${{ secrets.CUSTOM_TOKEN }}",
18 expected: "${{ secrets.CUSTOM_TOKEN }}",
19 },
20 {
21 name: "default fallback includes GH_AW_GITHUB_MCP_SERVER_TOKEN (for MCP and tools)",
22 customToken: "",
23 expected: "${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN || secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}",
24 },
25 }
26
27 for _, tt := range tests {
28 t.Run(tt.name, func(t *testing.T) {
29 result := getEffectiveGitHubToken(tt.customToken)
30 if result != tt.expected {
31 t.Errorf("getEffectiveGitHubToken() = %q, want %q", result, tt.expected)
32 }
33 })
34 }
35}
36
37func TestGetEffectiveSafeOutputGitHubToken(t *testing.T) {
38 tests := []struct {

Callers

nothing calls this directly

Calls 3

getEffectiveGitHubTokenFunction · 0.85
RunMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected