forked from cloudflare/cloudflare-go
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrors_external_test.go
More file actions
28 lines (24 loc) · 901 Bytes
/
errors_external_test.go
File metadata and controls
28 lines (24 loc) · 901 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package cloudflare_test
import (
"testing"
cloudflare "github.com/cloudflare/cloudflare-go"
"github.com/stretchr/testify/assert"
)
func TestError_CreateErrors(t *testing.T) {
baseErr := &cloudflare.Error{
StatusCode: 400,
ErrorCodes: []int{10000},
}
requestErr := cloudflare.NewRequestError(baseErr)
assert.True(t, requestErr.InternalErrorCodeIs(10000))
limitError := cloudflare.NewRatelimitError(baseErr)
assert.True(t, limitError.InternalErrorCodeIs(10000))
svcErr := cloudflare.NewServiceError(baseErr)
assert.True(t, svcErr.InternalErrorCodeIs(10000))
authErr := cloudflare.NewAuthenticationError(baseErr)
assert.True(t, authErr.InternalErrorCodeIs(10000))
authzErr := cloudflare.NewAuthorizationError(baseErr)
assert.True(t, authzErr.InternalErrorCodeIs(10000))
notFoundErr := cloudflare.NewNotFoundError(baseErr)
assert.True(t, notFoundErr.InternalErrorCodeIs(10000))
}