[#145] Fix util tests

Fixed contentType attribute difference in expected and actual results

Signed-off-by: Angira Kekteeva <kira@nspcc.ru>
This commit is contained in:
Angira Kekteeva 2021-07-07 18:49:59 +03:00
parent e7bebcc1aa
commit d09a4e4e6c
2 changed files with 6 additions and 1 deletions

View file

@ -127,6 +127,7 @@ func objectInfoFromMeta(bkt *BucketInfo, meta *object.Object, prefix, delimiter
index := strings.Index(tail, delimiter) index := strings.Index(tail, delimiter)
if index >= 0 { if index >= 0 {
isDir = true isDir = true
mimeType = ""
filename = prefix + tail[:index+1] filename = prefix + tail[:index+1]
userHeaders = nil userHeaders = nil
} else { } else {

View file

@ -28,12 +28,16 @@ func newTestObject(oid *object.ID, bkt *BucketInfo, name string) *object.Object
created.SetKey(object.AttributeTimestamp) created.SetKey(object.AttributeTimestamp)
created.SetValue(strconv.FormatInt(defaultTestCreated.Unix(), 10)) created.SetValue(strconv.FormatInt(defaultTestCreated.Unix(), 10))
contentType := object.NewAttribute()
contentType.SetKey(object.AttributeContentType)
contentType.SetValue(defaultTestContentType)
raw := object.NewRaw() raw := object.NewRaw()
raw.SetID(oid) raw.SetID(oid)
raw.SetOwnerID(bkt.Owner) raw.SetOwnerID(bkt.Owner)
raw.SetContainerID(bkt.CID) raw.SetContainerID(bkt.CID)
raw.SetPayload(defaultTestPayload) raw.SetPayload(defaultTestPayload)
raw.SetAttributes(filename, created) raw.SetAttributes(filename, created, contentType)
raw.SetPayloadSize(uint64(defaultTestPayloadLength)) raw.SetPayloadSize(uint64(defaultTestPayloadLength))
return raw.Object() return raw.Object()