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

Function TestGetEffectiveAgentGitHubToken

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

Source from the content-addressed store, hash-verified

91}
92
93func TestGetEffectiveAgentGitHubToken(t *testing.T) {
94 tests := []struct {
95 name string
96 customToken string
97 expected string
98 }{
99 {
100 name: "custom token has highest precedence",
101 customToken: "${{ secrets.CUSTOM_AGENT_TOKEN }}",
102 expected: "${{ secrets.CUSTOM_AGENT_TOKEN }}",
103 },
104 {
105 name: "default fallback chain for agent operations",
106 customToken: "",
107 expected: "${{ secrets.GH_AW_AGENT_TOKEN || secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}",
108 },
109 }
110
111 for _, tt := range tests {
112 t.Run(tt.name, func(t *testing.T) {
113 result := getEffectiveCopilotCodingAgentGitHubToken(tt.customToken)
114 if result != tt.expected {
115 t.Errorf("getEffectiveCopilotCodingAgentGitHubToken() = %q, want %q", result, tt.expected)
116 }
117 })
118 }
119}
120
121func TestGetEffectiveCITriggerGitHubToken(t *testing.T) {
122 tests := []struct {

Callers

nothing calls this directly

Calls 3

RunMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected