@@ -386,6 +386,48 @@ func TestRateLimits_overQuota(t *testing.T) {
386386 }
387387}
388388
389+ func 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+
389431func TestRateLimits_Marshal (t * testing.T ) {
390432 t .Parallel ()
391433 testJSONMarshal (t , & RateLimits {}, `{
0 commit comments