Skip to content

Commit

Permalink
Adding RateLimitSleep() to all tests
Browse files Browse the repository at this point in the history
  • Loading branch information
wneessen committed May 7, 2022
1 parent 0ded55e commit af15c66
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions breach_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion hibp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion paste_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit af15c66

Please # to comment.