mirror of
https://github.com/rclone/rclone
synced 2024-11-23 00:06:55 +01:00
fstests: Relax MimeType support checking #5587
Before this change we checked that features.ReadMimeTime was set if and only if the Object.MimeType method was implemented. However this test is overly general - we don't care if Objects advertise MimeType when features.ReadMimeTime is set provided that they always return an empty string (which is what a wrapping backend might do). This patch implements that logic.
This commit is contained in:
parent
cc2f6f722c
commit
8cd3251b57
@ -1333,12 +1333,14 @@ func Run(t *testing.T, opt *Opt) {
|
||||
features := f.Features()
|
||||
obj := findObject(ctx, t, f, file1.Path)
|
||||
do, ok := obj.(fs.MimeTyper)
|
||||
require.Equal(t, features.ReadMimeType, ok, "mismatch between Object.MimeType and Features.ReadMimeType")
|
||||
if !ok {
|
||||
require.False(t, features.ReadMimeType, "Features.ReadMimeType is set but Object.MimeType method not found")
|
||||
t.Skip("MimeType method not supported")
|
||||
}
|
||||
mimeType := do.MimeType(ctx)
|
||||
if features.WriteMimeType {
|
||||
if !features.ReadMimeType {
|
||||
require.Equal(t, "", mimeType, "Features.ReadMimeType is not set but Object.MimeType returned a non-empty MimeType")
|
||||
} else if features.WriteMimeType {
|
||||
assert.Equal(t, file1MimeType, mimeType, "can read and write mime types but failed")
|
||||
} else {
|
||||
if strings.ContainsRune(mimeType, ';') {
|
||||
|
Loading…
Reference in New Issue
Block a user