From d103ed6ca97ca5a2669f6cf5fe4b3d2a9c945f26 Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Wed, 17 May 2017 16:51:25 -0400 Subject: Upgrading server dependancies (#6431) --- .../minio/minio-go/api-error-response_test.go | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'vendor/github.com/minio/minio-go/api-error-response_test.go') 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) + } +} -- cgit v1.2.3-1-g7c22