summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/minio/minio-go/api-error-response_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/minio/minio-go/api-error-response_test.go')
-rw-r--r--vendor/github.com/minio/minio-go/api-error-response_test.go21
1 files changed, 20 insertions, 1 deletions
diff --git a/vendor/github.com/minio/minio-go/api-error-response_test.go b/vendor/github.com/minio/minio-go/api-error-response_test.go
index 11f57165f..595cb50bd 100644
--- a/vendor/github.com/minio/minio-go/api-error-response_test.go
+++ b/vendor/github.com/minio/minio-go/api-error-response_test.go
@@ -72,6 +72,7 @@ func TestHttpRespToErrorResponse(t *testing.T) {
RequestID: resp.Header.Get("x-amz-request-id"),
HostID: resp.Header.Get("x-amz-id-2"),
Region: resp.Header.Get("x-amz-bucket-region"),
+ Headers: resp.Header,
}
return errResp
}
@@ -172,7 +173,7 @@ func TestHttpRespToErrorResponse(t *testing.T) {
for i, testCase := range testCases {
actualResult := httpRespToErrorResponse(testCase.inputHTTPResp, testCase.bucketName, testCase.objectName)
if !reflect.DeepEqual(testCase.expectedResult, actualResult) {
- t.Errorf("Test %d: Expected result to be '%+v', but instead got '%+v'", i+1, testCase.expectedResult, actualResult)
+ t.Errorf("Test %d: Expected result to be '%#v', but instead got '%#v'", i+1, testCase.expectedResult, actualResult)
}
}
}
@@ -261,3 +262,21 @@ func TestErrInvalidArgument(t *testing.T) {
t.Errorf("Expected result to be '%+v', but instead got '%+v'", expectedResult, actualResult)
}
}
+
+// Tests if the Message field is missing.
+func TestErrWithoutMessage(t *testing.T) {
+ errResp := ErrorResponse{
+ Code: "AccessDenied",
+ RequestID: "minio",
+ }
+ if errResp.Error() != "Access Denied." {
+ t.Errorf("Expected \"Access Denied.\", got %s", errResp)
+ }
+ errResp = ErrorResponse{
+ Code: "InvalidArgument",
+ RequestID: "minio",
+ }
+ if errResp.Error() != "Error response code InvalidArgument." {
+ t.Errorf("Expected \"Error response code InvalidArgument.\", got %s", errResp)
+ }
+}