-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherror_test.go
More file actions
30 lines (26 loc) · 831 Bytes
/
error_test.go
File metadata and controls
30 lines (26 loc) · 831 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
29
30
// Copyright 2020 - MinIO, Inc. All rights reserved.
// Use of this source code is governed by the AGPLv3
// license that can be found in the LICENSE file.
package kes
import (
"net/http"
"testing"
)
var newErrorTests = []struct {
Code int
Message string
Err Error
}{
{Code: http.StatusBadRequest, Message: "", Err: NewError(http.StatusBadRequest, "")},
{Code: http.StatusNotFound, Message: "key does not exist", Err: ErrKeyNotFound},
{Code: http.StatusBadRequest, Message: "key does already exist", Err: ErrKeyExists},
{Code: http.StatusForbidden, Message: "prohibited by policy", Err: ErrNotAllowed},
}
func TestNewError(t *testing.T) {
for i, test := range newErrorTests {
err := NewError(test.Code, test.Message)
if err != test.Err {
t.Fatalf("Test %d: got %v - want %v", i, err, test.Err)
}
}
}