(t *testing.T, permission string)
| 85 | } |
| 86 | |
| 87 | func 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 | |
| 100 | func newMockRepoAccessCache(t *testing.T, ttl time.Duration) (*RepoAccessCache, *countingTransport) { |
| 101 | t.Helper() |
no test coverage detected