(t *testing.T)
| 4008 | } |
| 4009 | |
| 4010 | func 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 | |
| 4039 | func TestUnauthenticatedRateLimitedTransport_missingFields(t *testing.T) { |
| 4040 | t.Parallel() |
nothing calls this directly
no test coverage detected
searching dependent graphs…