MCPcopy Index your code
hub / github.com/google/go-github / TestUnauthenticatedRateLimitedTransport

Function TestUnauthenticatedRateLimitedTransport

github/github_test.go:4010–4037  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

4008}
4009
4010func TestUnauthenticatedRateLimitedTransport(t *testing.T) {
4011 t.Parallel()
4012 client, mux, _ := setup(t)
4013
4014 clientID, clientSecret := "id", "secret"
4015 mux.HandleFunc("/", func(_ http.ResponseWriter, r *http.Request) {
4016 id, secret, ok := r.BasicAuth()
4017 if !ok {
4018 t.Error("request does not contain basic auth credentials")
4019 }
4020 if id != clientID {
4021 t.Errorf("request contained basic auth username %q, want %q", id, clientID)
4022 }
4023 if secret != clientSecret {
4024 t.Errorf("request contained basic auth password %q, want %q", secret, clientSecret)
4025 }
4026 })
4027
4028 tp := &UnauthenticatedRateLimitedTransport{
4029 ClientID: clientID,
4030 ClientSecret: clientSecret,
4031 }
4032 unauthedClient := mustNewClient(t, WithHTTPClient(tp.Client()))
4033 unauthedClient.baseURL = client.baseURL
4034 req, _ := unauthedClient.NewRequest(t.Context(), "GET", ".", nil)
4035 _, err := unauthedClient.Do(req, nil)
4036 assertNilError(t, err)
4037}
4038
4039func TestUnauthenticatedRateLimitedTransport_missingFields(t *testing.T) {
4040 t.Parallel()

Callers

nothing calls this directly

Calls 8

ClientMethod · 0.95
mustNewClientFunction · 0.85
WithHTTPClientFunction · 0.85
NewRequestMethod · 0.80
setupFunction · 0.70
assertNilErrorFunction · 0.70
ErrorMethod · 0.45
DoMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…