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

Function TestRateLimits

test/integration/misc_test.go:49–67  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

47}
48
49func TestRateLimits(t *testing.T) {
50 limits, _, err := client.RateLimit.Get(t.Context())
51 if err != nil {
52 t.Fatalf("RateLimits returned error: %v", err)
53 }
54
55 // do some sanity checks
56 if limits.Core.Limit == 0 {
57 t.Error("RateLimits returned 0 core limit")
58 }
59
60 if limits.Core.Limit < limits.Core.Remaining {
61 t.Error("Core.Limits is less than Core.Remaining.")
62 }
63
64 if limits.Core.Reset.Time.Before(time.Now().Add(-1 * time.Minute)) {
65 t.Error("Core.Reset is more than 1 minute in the past; that doesn't seem right.")
66 }
67}

Callers

nothing calls this directly

Calls 3

AddMethod · 0.80
GetMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…