From d09a4e4e6c9bb924949670ae3ecf3cd3b287472c Mon Sep 17 00:00:00 2001 From: Angira Kekteeva Date: Wed, 7 Jul 2021 18:49:59 +0300 Subject: [PATCH] [#145] Fix util tests Fixed contentType attribute difference in expected and actual results Signed-off-by: Angira Kekteeva --- api/layer/util.go | 1 + api/layer/util_test.go | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/api/layer/util.go b/api/layer/util.go index c4f355b4b..abd8dfd2f 100644 --- a/api/layer/util.go +++ b/api/layer/util.go @@ -127,6 +127,7 @@ func objectInfoFromMeta(bkt *BucketInfo, meta *object.Object, prefix, delimiter index := strings.Index(tail, delimiter) if index >= 0 { isDir = true + mimeType = "" filename = prefix + tail[:index+1] userHeaders = nil } else { diff --git a/api/layer/util_test.go b/api/layer/util_test.go index 71ad13b2e..9b44d8544 100644 --- a/api/layer/util_test.go +++ b/api/layer/util_test.go @@ -28,12 +28,16 @@ func newTestObject(oid *object.ID, bkt *BucketInfo, name string) *object.Object created.SetKey(object.AttributeTimestamp) created.SetValue(strconv.FormatInt(defaultTestCreated.Unix(), 10)) + contentType := object.NewAttribute() + contentType.SetKey(object.AttributeContentType) + contentType.SetValue(defaultTestContentType) + raw := object.NewRaw() raw.SetID(oid) raw.SetOwnerID(bkt.Owner) raw.SetContainerID(bkt.CID) raw.SetPayload(defaultTestPayload) - raw.SetAttributes(filename, created) + raw.SetAttributes(filename, created, contentType) raw.SetPayloadSize(uint64(defaultTestPayloadLength)) return raw.Object()