summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/minio/minio-go/bucket-cache_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/minio/minio-go/bucket-cache_test.go')
-rw-r--r--vendor/github.com/minio/minio-go/bucket-cache_test.go49
1 files changed, 9 insertions, 40 deletions
diff --git a/vendor/github.com/minio/minio-go/bucket-cache_test.go b/vendor/github.com/minio/minio-go/bucket-cache_test.go
index 6ae4e7be4..0c068c966 100644
--- a/vendor/github.com/minio/minio-go/bucket-cache_test.go
+++ b/vendor/github.com/minio/minio-go/bucket-cache_test.go
@@ -1,6 +1,5 @@
/*
- * Minio Go Library for Amazon S3 Compatible Cloud Storage
- * (C) 2015, 2016, 2017 Minio, Inc.
+ * Minio Go Library for Amazon S3 Compatible Cloud Storage (C) 2016, 2016 Minio, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,7 +27,6 @@ import (
"reflect"
"testing"
- "github.com/minio/minio-go/pkg/credentials"
"github.com/minio/minio-go/pkg/s3signer"
)
@@ -88,46 +86,17 @@ func TestGetBucketLocationRequest(t *testing.T) {
// Set UserAgent for the request.
c.setUserAgent(req)
- // Get credentials from the configured credentials provider.
- value, err := c.credsProvider.Get()
- if err != nil {
- return nil, err
- }
-
- var (
- signerType = value.SignerType
- accessKeyID = value.AccessKeyID
- secretAccessKey = value.SecretAccessKey
- sessionToken = value.SessionToken
- )
-
- // Custom signer set then override the behavior.
- if c.overrideSignerType != credentials.SignatureDefault {
- signerType = c.overrideSignerType
+ // Set sha256 sum for signature calculation only with signature version '4'.
+ if c.signature.isV4() {
+ req.Header.Set("X-Amz-Content-Sha256", hex.EncodeToString(sum256([]byte{})))
}
- // If signerType returned by credentials helper is anonymous,
- // then do not sign regardless of signerType override.
- if value.SignerType == credentials.SignatureAnonymous {
- signerType = credentials.SignatureAnonymous
+ // Sign the request.
+ if c.signature.isV4() {
+ req = s3signer.SignV4(*req, c.accessKeyID, c.secretAccessKey, "us-east-1")
+ } else if c.signature.isV2() {
+ req = s3signer.SignV2(*req, c.accessKeyID, c.secretAccessKey)
}
-
- // Set sha256 sum for signature calculation only
- // with signature version '4'.
- switch {
- case signerType.IsV4():
- var contentSha256 string
- if c.secure {
- contentSha256 = unsignedPayload
- } else {
- contentSha256 = hex.EncodeToString(sum256([]byte{}))
- }
- req.Header.Set("X-Amz-Content-Sha256", contentSha256)
- req = s3signer.SignV4(*req, accessKeyID, secretAccessKey, sessionToken, "us-east-1")
- case signerType.IsV2():
- req = s3signer.SignV2(*req, accessKeyID, secretAccessKey)
- }
-
return req, nil
}