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

Function TestGetGitHubAllowedTools

pkg/workflow/copilot_github_mcp_test.go:122–206  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

120}
121
122func TestGetGitHubAllowedTools(t *testing.T) {
123 tests := []struct {
124 name string
125 githubTool map[string]any
126 expected []string
127 }{
128 {
129 name: "Specific allowed tools",
130 githubTool: map[string]any{
131 "allowed": []string{"get_repository", "list_commits"},
132 },
133 expected: []string{"get_repository", "list_commits"},
134 },
135 {
136 name: "Empty allowed array",
137 githubTool: map[string]any{
138 "allowed": []string{},
139 },
140 expected: []string{},
141 },
142 {
143 name: "No allowed field",
144 githubTool: map[string]any{},
145 expected: nil,
146 },
147 {
148 name: "Allowed with []any type",
149 githubTool: map[string]any{
150 "allowed": []any{"tool1", "tool2", "tool3"},
151 },
152 expected: []string{"tool1", "tool2", "tool3"},
153 },
154 {
155 name: "Allowed supports object entries with max-calls",
156 githubTool: map[string]any{
157 "allowed": []any{
158 map[string]any{"name": "issue_read", "max-calls": 1},
159 "list_labels",
160 },
161 },
162 expected: []string{"issue_read", "list_labels"},
163 },
164 {
165 name: "Allowed string entries with colons are preserved as tool names",
166 githubTool: map[string]any{
167 "allowed": []any{"issue_read:1", "list_labels"},
168 },
169 expected: []string{"issue_read:1", "list_labels"},
170 },
171 {
172 name: "Nil tool",
173 githubTool: nil,
174 expected: nil,
175 },
176 }
177
178 for _, tt := range tests {
179 t.Run(tt.name, func(t *testing.T) {

Callers

nothing calls this directly

Calls 3

getGitHubAllowedToolsFunction · 0.85
RunMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected