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

Function newMockRESTServer

pkg/lockdown/lockdown_test.go:87–98  ·  view source on GitHub ↗
(t *testing.T, permission string)

Source from the content-addressed store, hash-verified

85}
86
87func newMockRESTServer(t *testing.T, permission string) *gogithub.Client {
88 t.Helper()
89 restServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, _ *http.Request) {
90 resp := gogithub.RepositoryPermissionLevel{Permission: gogithub.Ptr(permission)}
91 w.Header().Set("Content-Type", "application/json")
92 _ = json.NewEncoder(w).Encode(resp)
93 }))
94 t.Cleanup(restServer.Close)
95 restClient, err := gogithub.NewClient(gogithub.WithEnterpriseURLs(restServer.URL+"/", restServer.URL+"/"))
96 require.NoError(t, err)
97 return restClient
98}
99
100func newMockRepoAccessCache(t *testing.T, ttl time.Duration) (*RepoAccessCache, *countingTransport) {
101 t.Helper()

Calls 1

HeaderMethod · 0.80

Tested by

no test coverage detected