mirror of
https://github.com/rclone/rclone.git
synced 2025-08-26 12:50:37 +02:00
lsjson,lsf: make sure metadata appears for directories
This commit is contained in:
@@ -174,7 +174,7 @@ func TestListJSON(t *testing.T) {
|
||||
}, {
|
||||
name: "Metadata",
|
||||
opt: operations.ListJSONOpt{
|
||||
FilesOnly: true,
|
||||
FilesOnly: false,
|
||||
Metadata: true,
|
||||
},
|
||||
want: []*operations.ListJSONItem{{
|
||||
@@ -183,6 +183,10 @@ func TestListJSON(t *testing.T) {
|
||||
Size: 5,
|
||||
ModTime: operations.Timestamp{When: t1},
|
||||
IsDir: false,
|
||||
}, {
|
||||
Path: "sub",
|
||||
Name: "sub",
|
||||
IsDir: true,
|
||||
}},
|
||||
},
|
||||
} {
|
||||
@@ -203,6 +207,15 @@ func TestListJSON(t *testing.T) {
|
||||
} else {
|
||||
assert.NotEqual(t, "", got[i].MimeType)
|
||||
}
|
||||
if test.opt.Metadata {
|
||||
features := r.Fremote.Features()
|
||||
if features.ReadMetadata && !got[i].IsDir {
|
||||
assert.Greater(t, len(got[i].Metadata), 0, "Expecting metadata for file")
|
||||
}
|
||||
if features.ReadDirMetadata && got[i].IsDir {
|
||||
assert.Greater(t, len(got[i].Metadata), 0, "Expecting metadata for dir")
|
||||
}
|
||||
}
|
||||
if test.opt.ShowHash {
|
||||
hashes := got[i].Hashes
|
||||
assert.NotNil(t, hashes)
|
||||
|
Reference in New Issue
Block a user