MCPcopy Index your code
hub / github.com/github/github-mcp-server / TestCreateHTTPFeatureChecker

Function TestCreateHTTPFeatureChecker

pkg/http/server_test.go:13–126  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

11)
12
13func TestCreateHTTPFeatureChecker(t *testing.T) {
14 tests := []struct {
15 name string
16 staticFeatures []string
17 staticInsiders bool
18 flagName string
19 headerFeatures []string
20 insidersMode bool
21 wantEnabled bool
22 }{
23 {
24 name: "allowed issues_granular flag accepted from header",
25 flagName: github.FeatureFlagIssuesGranular,
26 headerFeatures: []string{github.FeatureFlagIssuesGranular},
27 wantEnabled: true,
28 },
29 {
30 name: "allowed pull_requests_granular flag accepted from header",
31 flagName: github.FeatureFlagPullRequestsGranular,
32 headerFeatures: []string{github.FeatureFlagPullRequestsGranular},
33 wantEnabled: true,
34 },
35 {
36 name: "MCP Apps flag accepted from header",
37 flagName: github.MCPAppsFeatureFlag,
38 headerFeatures: []string{github.MCPAppsFeatureFlag},
39 wantEnabled: true,
40 },
41 {
42 name: "unknown flag in header is ignored",
43 flagName: "unknown_flag",
44 headerFeatures: []string{"unknown_flag"},
45 wantEnabled: false,
46 },
47 {
48 name: "allowed flag not in header returns false",
49 flagName: github.FeatureFlagIssuesGranular,
50 headerFeatures: nil,
51 wantEnabled: false,
52 },
53 {
54 name: "allowed flag with different flag in header returns false",
55 flagName: github.FeatureFlagIssuesGranular,
56 headerFeatures: []string{github.FeatureFlagPullRequestsGranular},
57 wantEnabled: false,
58 },
59 {
60 name: "multiple allowed flags in header",
61 flagName: github.FeatureFlagIssuesGranular,
62 headerFeatures: []string{github.FeatureFlagIssuesGranular, github.FeatureFlagPullRequestsGranular},
63 wantEnabled: true,
64 },
65 {
66 name: "empty header features",
67 flagName: github.FeatureFlagIssuesGranular,
68 headerFeatures: []string{},
69 wantEnabled: false,
70 },

Callers

nothing calls this directly

Calls 1

createHTTPFeatureCheckerFunction · 0.85

Tested by

no test coverage detected