MCPcopy
hub / github.com/github/github-mcp-server / TestGetToolScopeMap

Function TestGetToolScopeMap

pkg/scopes/map_test.go:10–29  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

8)
9
10func TestGetToolScopeMap(t *testing.T) {
11 // Reset and set up a test map
12 SetGlobalToolScopeMap(ToolScopeMap{
13 "test_tool": &ToolScopeInfo{
14 RequiredScopes: []string{"read:org"},
15 AcceptedScopes: []string{"read:org", "write:org", "admin:org"},
16 },
17 })
18
19 m, err := GetToolScopeMap()
20 require.NoError(t, err)
21 require.NotNil(t, m)
22 require.Greater(t, len(m), 0, "expected at least one tool in the scope map")
23
24 testTool, ok := m["test_tool"]
25 require.True(t, ok, "expected test_tool to be in the scope map")
26 assert.Contains(t, testTool.RequiredScopes, "read:org")
27 assert.Contains(t, testTool.AcceptedScopes, "read:org")
28 assert.Contains(t, testTool.AcceptedScopes, "admin:org")
29}
30
31func TestGetToolScopeInfo(t *testing.T) {
32 // Set up test scope map

Callers

nothing calls this directly

Calls 2

SetGlobalToolScopeMapFunction · 0.85
GetToolScopeMapFunction · 0.85

Tested by

no test coverage detected