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

Function TestRateLimits_bypassRateLimitCheckContext

github/rate_limit_test.go:389–429  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

387}
388
389func TestRateLimits_bypassRateLimitCheckContext(t *testing.T) {
390 t.Parallel()
391 tests := []struct {
392 name string
393 disableRateLimitCheck bool
394 wantBypassValue any
395 }{
396 {
397 name: "DisableRateLimitCheck disabled",
398 disableRateLimitCheck: false,
399 wantBypassValue: true,
400 },
401 {
402 name: "DisableRateLimitCheck enabled",
403 disableRateLimitCheck: true,
404 wantBypassValue: nil,
405 },
406 }
407
408 for _, tt := range tests {
409 t.Run(tt.name, func(t *testing.T) {
410 t.Parallel()
411 client, mux, _ := setup(t)
412 client.disableRateLimitCheck = tt.disableRateLimitCheck
413
414 mux.HandleFunc("/rate_limit", func(w http.ResponseWriter, r *http.Request) {
415 testMethod(t, r, "GET")
416 fmt.Fprint(w, `{"resources":{}}`)
417 })
418
419 _, resp, err := client.RateLimit.Get(t.Context())
420 if err != nil {
421 t.Errorf("RateLimits returned error: %v", err)
422 }
423
424 if got, want := resp.Request.Context().Value(BypassRateLimitCheck), tt.wantBypassValue; got != want {
425 t.Errorf("Request context bypass value = %v, want %v", got, want)
426 }
427 })
428 }
429}
430
431func TestRateLimits_Marshal(t *testing.T) {
432 t.Parallel()

Callers

nothing calls this directly

Calls 4

testMethodFunction · 0.85
setupFunction · 0.70
RunMethod · 0.45
GetMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…