diff options
Diffstat (limited to 'api-compose-object_test.go')
-rw-r--r-- | api-compose-object_test.go | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/api-compose-object_test.go b/api-compose-object_test.go index 14f0e18..295bbc2 100644 --- a/api-compose-object_test.go +++ b/api-compose-object_test.go @@ -18,6 +18,7 @@ package minio import ( "reflect" + "strings" "testing" ) @@ -118,3 +119,37 @@ func TestCalculateEvenSplits(t *testing.T) { } } } + +func TestGetUserMetaHeadersMap(t *testing.T) { + + userMetadata := map[string]string{ + "test": "test", + "x-amz-acl": "public-read-write", + "content-type": "application/binary", + "X-Amz-Storage-Class": "rrs", + "x-amz-grant-write": "test@exo.ch", + } + + destInfo := &DestinationInfo{"bucket", "object", nil, userMetadata} + + r := destInfo.getUserMetaHeadersMap(true) + + i := 0 + + if _, ok := r["x-amz-metadata-directive"]; !ok { + t.Errorf("Test %d - metadata directive was expected but is missing", i) + i++ + } + + for k := range r { + if strings.HasSuffix(k, "test") && !strings.HasPrefix(k, "x-amz-meta-") { + t.Errorf("Test %d - meta %q was expected as an x amz meta", i, k) + i++ + } + + if !strings.HasSuffix(k, "test") && strings.HasPrefix(k, "x-amz-meta-") { + t.Errorf("Test %d - an amz/standard/storageClass Header was expected but got an x amz meta data", i) + i++ + } + } +} |