From af15c66865fdc4262555ec6385def95cd0807623 Mon Sep 17 00:00:00 2001 From: Winni Neessen Date: Sat, 7 May 2022 14:55:33 +0200 Subject: [PATCH] Adding RateLimitSleep() to all tests --- breach_test.go | 8 ++++---- hibp_test.go | 2 +- paste_test.go | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/breach_test.go b/breach_test.go index b69270c..d871b2d 100644 --- a/breach_test.go +++ b/breach_test.go @@ -41,7 +41,7 @@ func TestBreachesWithDomain(t *testing.T) { {"example.com is not breached", "example.com", false}, } - hc := New() + hc := New(WithRateLimitSleep()) for _, tc := range testTable { t.Run(tc.testName, func(t *testing.T) { breachList, _, err := hc.BreachApi.Breaches(WithDomain(tc.domain)) @@ -80,7 +80,7 @@ func TestBreachesWithoutUnverified(t *testing.T) { {"xiaomi.cn is breached but not verified", "xiaomi.cn", true, false}, } - hc := New() + hc := New(WithRateLimitSleep()) for _, tc := range testTable { t.Run(tc.testName, func(t *testing.T) { breachList, _, err := hc.BreachApi.Breaches(WithDomain(tc.domain), WithoutUnverified()) @@ -108,7 +108,7 @@ func TestBreachByName(t *testing.T) { {"Example is not a known breach", "Example", false, true}, } - hc := New() + hc := New(WithRateLimitSleep()) for _, tc := range testTable { t.Run(tc.testName, func(t *testing.T) { breachDetails, _, err := hc.BreachApi.BreachByName(tc.breachName) @@ -159,7 +159,7 @@ func TestBreachedAccount(t *testing.T) { if apiKey == "" { t.SkipNow() } - hc := New(WithApiKey(apiKey)) + hc := New(WithApiKey(apiKey), WithRateLimitSleep()) for _, tc := range testTable { t.Run(tc.testName, func(t *testing.T) { breachDetails, _, err := hc.BreachApi.BreachedAccount( diff --git a/hibp_test.go b/hibp_test.go index 0dcf795..f2112c9 100644 --- a/hibp_test.go +++ b/hibp_test.go @@ -44,7 +44,7 @@ func TestNewWithPwnedPadding(t *testing.T) { // TestNewWithApiKey tests the New() function with the API key set func TestNewWithApiKey(t *testing.T) { apiKey := os.Getenv("HIBP_API_KEY") - hc := New(WithApiKey(apiKey)) + hc := New(WithApiKey(apiKey), WithRateLimitSleep()) if hc.ak != apiKey { t.Errorf("hibp client API key was not set properly. Expected %s, got: %s", apiKey, hc.ak) diff --git a/paste_test.go b/paste_test.go index 0244d83..f495534 100644 --- a/paste_test.go +++ b/paste_test.go @@ -21,7 +21,7 @@ func TestPasteAccount(t *testing.T) { if apiKey == "" { t.SkipNow() } - hc := New(WithApiKey(apiKey)) + hc := New(WithApiKey(apiKey), WithRateLimitSleep()) for _, tc := range testTable { t.Run(tc.testName, func(t *testing.T) { pasteDetails, _, err := hc.PasteApi.PastedAccount(